-
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Добавить методы appWidgets * Добавить тесты appWidgets
- Loading branch information
Showing
27 changed files
with
851 additions
and
60 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
VkNet.Tests/Categories/AppWidgets/GetAppImageUploadServerTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using NUnit.Framework; | ||
using VkNet.Enums.SafetyEnums; | ||
using VkNet.Tests.Infrastructure; | ||
|
||
namespace VkNet.Tests.Categories | ||
{ | ||
[TestFixture] | ||
[ExcludeFromCodeCoverage] | ||
public class GetAppImageUploadServerTest : CategoryBaseTest | ||
{ | ||
protected override string Folder => "AppWidgets"; | ||
|
||
[Test] | ||
public void GetAppImageUploadServer() | ||
{ | ||
Url = "https://api.vk.com/method/appWidgets.getAppImageUploadServer"; | ||
|
||
ReadCategoryJsonPath(nameof(GetAppImageUploadServer)); | ||
|
||
var result = Api.AppWidgets.GetAppImageUploadServer(AppWidgetImageType.FiftyOnFifty); | ||
|
||
Assert.IsNotNull(result.UploadUrl); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using VkNet.Enums.SafetyEnums; | ||
using VkNet.Tests.Infrastructure; | ||
|
||
namespace VkNet.Tests.Categories | ||
{ | ||
[TestFixture] | ||
[ExcludeFromCodeCoverage] | ||
public class GetAppImagesTest : CategoryBaseTest | ||
{ | ||
protected override string Folder => "AppWidgets"; | ||
|
||
[Test] | ||
public void GetAppImages() | ||
{ | ||
Url = "https://api.vk.com/method/appWidgets.getAppImages"; | ||
|
||
ReadCategoryJsonPath(nameof(GetAppImages)); | ||
|
||
var result = Api.AppWidgets.GetAppImages(0, 10, AppWidgetImageType.FiftyOnFifty); | ||
|
||
Assert.IsNotNull(result.Items.First().Images.First().Url); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
VkNet.Tests/Categories/AppWidgets/GetGroupImageUploadServerTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using NUnit.Framework; | ||
using VkNet.Enums.SafetyEnums; | ||
using VkNet.Tests.Infrastructure; | ||
|
||
namespace VkNet.Tests.Categories | ||
{ | ||
[TestFixture] | ||
[ExcludeFromCodeCoverage] | ||
public class GetGroupImageUploadServerTest : CategoryBaseTest | ||
{ | ||
protected override string Folder => "AppWidgets"; | ||
|
||
[Test] | ||
public void GetGroupImageUploadServer() | ||
{ | ||
Url = "https://api.vk.com/method/appWidgets.getGroupImageUploadServer"; | ||
|
||
ReadCategoryJsonPath(nameof(GetGroupImageUploadServer)); | ||
|
||
var result = Api.AppWidgets.GetGroupImageUploadServer(AppWidgetImageType.FiftyOnFifty); | ||
|
||
Assert.IsNotNull(result.UploadUrl); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using VkNet.Enums.SafetyEnums; | ||
using VkNet.Tests.Infrastructure; | ||
|
||
namespace VkNet.Tests.Categories | ||
{ | ||
[TestFixture] | ||
[ExcludeFromCodeCoverage] | ||
public class GetGroupImagesTest : CategoryBaseTest | ||
{ | ||
protected override string Folder => "AppWidgets"; | ||
|
||
[Test] | ||
public void GetGroupImages() | ||
{ | ||
Url = "https://api.vk.com/method/appWidgets.getGroupImages"; | ||
|
||
ReadCategoryJsonPath(nameof(GetGroupImages)); | ||
|
||
var result = Api.AppWidgets.GetGroupImages(0, 10, AppWidgetImageType.FiftyOnFifty); | ||
|
||
Assert.IsNotNull(result.Items.First().Images.First().Url); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using VkNet.Tests.Infrastructure; | ||
|
||
namespace VkNet.Tests.Categories | ||
{ | ||
[TestFixture] | ||
[ExcludeFromCodeCoverage] | ||
public class GetImagesByIdTest : CategoryBaseTest | ||
{ | ||
protected override string Folder => "AppWidgets"; | ||
|
||
[Test] | ||
public void GetAppImages() | ||
{ | ||
Url = "https://api.vk.com/method/appWidgets.getImagesById"; | ||
|
||
ReadCategoryJsonPath(nameof(GetAppImages)); | ||
|
||
var result = Api.AppWidgets.GetImagesById("7309583_1192027"); | ||
|
||
Assert.IsNotNull(result); | ||
Assert.AreEqual("7309583_1192027", result.First().Id); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using VkNet.Tests.Infrastructure; | ||
|
||
namespace VkNet.Tests.Categories | ||
{ | ||
[TestFixture] | ||
[ExcludeFromCodeCoverage] | ||
public class SaveAppImageTest : CategoryBaseTest | ||
{ | ||
protected override string Folder => "AppWidgets"; | ||
|
||
[Test] | ||
public void SaveAppImage() | ||
{ | ||
Url = "https://api.vk.com/method/appWidgets.saveAppImage"; | ||
|
||
ReadCategoryJsonPath(nameof(SaveAppImage)); | ||
|
||
var result = Api.AppWidgets.SaveAppImage( | ||
"0f009dbdd6154c88b8", | ||
"eyJvaWQiOjczMDk1ODMsInR5cGUiOjUsInBob3RvIjp7InBob3RvIjoiMjRkNmQwOWU1ZXgiLCJzaXplcyI6W1siYSIsMjA2NzIwNTg5LCI1YmYxOCIsInJ2a3JxRWRsR0tVIiw1MCw1MF0sWyJiIiwyMDY3MjA1ODksIjViZjE5IiwiYnE2VXhhakJaUFEiLDEwMCwxMDBdLFsiYyIsMjA2NzIwNTg5LCI1YmYxYSIsImI5eTlEalUtTVR3IiwxNTAsMTUwXV0sImtpZCI6IjhlMDkzZjYxOGQyY2M5MzJiMDU5YmRlYTViNjVhYmNhIiwiZGVidWciOiJ4Y2MiLCJ1cmxzIjpbInYyMDY3MjA1ODlcLzViZjE4XC9ydmtycUVkbEdLVS5qcGciLCJ2MjA2NzIwNTg5XC81YmYxOVwvYnE2VXhhakJaUFEuanBnIiwidjIwNjcyMDU4OVwvNWJmMWFcL2I5eTlEalUtTVR3LmpwZyJdfSwiYndhY3QiOiJhcHBfd2lkZ2V0X2ltYWdlIiwic2VydmVyIjoyMDY3MjAsIm1pZCI6MCwiX3NpZyI6ImNhMjI3ZWZlY2MxMjhjMzgxNTYzZjBjOGQ4YTM4ZTJlIn0"); | ||
|
||
Assert.IsNotNull(result.Images.First().Url); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using VkNet.Tests.Infrastructure; | ||
|
||
namespace VkNet.Tests.Categories | ||
{ | ||
[TestFixture] | ||
[ExcludeFromCodeCoverage] | ||
public class SaveGroupImageTest : CategoryBaseTest | ||
{ | ||
protected override string Folder => "AppWidgets"; | ||
|
||
[Test] | ||
public void SaveGroupImage() | ||
{ | ||
Url = "https://api.vk.com/method/appWidgets.saveGroupImage"; | ||
|
||
ReadCategoryJsonPath(nameof(SaveGroupImage)); | ||
|
||
var result = Api.AppWidgets.SaveGroupImage( | ||
"0f009dbdd6154c88b8", | ||
"eyJvaWQiOjczMDk1ODMsInR5cGUiOjUsInBob3RvIjp7InBob3RvIjoiMjRkNmQwOWU1ZXgiLCJzaXplcyI6W1siYSIsMjA2NzIwNTg5LCI1YmYxOCIsInJ2a3JxRWRsR0tVIiw1MCw1MF0sWyJiIiwyMDY3MjA1ODksIjViZjE5IiwiYnE2VXhhakJaUFEiLDEwMCwxMDBdLFsiYyIsMjA2NzIwNTg5LCI1YmYxYSIsImI5eTlEalUtTVR3IiwxNTAsMTUwXV0sImtpZCI6IjhlMDkzZjYxOGQyY2M5MzJiMDU5YmRlYTViNjVhYmNhIiwiZGVidWciOiJ4Y2MiLCJ1cmxzIjpbInYyMDY3MjA1ODlcLzViZjE4XC9ydmtycUVkbEdLVS5qcGciLCJ2MjA2NzIwNTg5XC81YmYxOVwvYnE2VXhhakJaUFEuanBnIiwidjIwNjcyMDU4OVwvNWJmMWFcL2I5eTlEalUtTVR3LmpwZyJdfSwiYndhY3QiOiJhcHBfd2lkZ2V0X2ltYWdlIiwic2VydmVyIjoyMDY3MjAsIm1pZCI6MCwiX3NpZyI6ImNhMjI3ZWZlY2MxMjhjMzgxNTYzZjBjOGQ4YTM4ZTJlIn0"); | ||
|
||
Assert.IsNotNull(result.Images.First().Url); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using NUnit.Framework; | ||
using VkNet.Enums.SafetyEnums; | ||
using VkNet.Tests.Infrastructure; | ||
|
||
namespace VkNet.Tests.Categories | ||
{ | ||
[TestFixture] | ||
[ExcludeFromCodeCoverage] | ||
public class Update : CategoryBaseTest | ||
{ | ||
protected override string Folder => "AppWidgets"; | ||
|
||
[Test] | ||
public void EnableOnline() | ||
{ | ||
Url = "https://api.vk.com/method/appWidgets.update"; | ||
|
||
ReadJsonFile(JsonPaths.True); | ||
|
||
var result = Api.AppWidgets.Update("string", AppWidgetType.Donation); | ||
|
||
Assert.IsTrue(result); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
VkNet.Tests/TestData/Categories/AppWidgets/GetAppImageUploadServer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"response": { | ||
"upload_url": "some_url" | ||
} | ||
} |
112 changes: 112 additions & 0 deletions
112
VkNet.Tests/TestData/Categories/AppWidgets/GetAppImages.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
{ | ||
"response": { | ||
"count": 5, | ||
"items": [ | ||
{ | ||
"id": "7309583_1192027", | ||
"type": "50x50", | ||
"images": [ | ||
{ | ||
"url": "https://sun9-52.userapi.com/c206720/v206720589/5bf18/rvkrqEdlGKU.jpg", | ||
"width": 50, | ||
"height": 50 | ||
}, | ||
{ | ||
"url": "https://sun9-46.userapi.com/c206720/v206720589/5bf19/bq6UxajBZPQ.jpg", | ||
"width": 100, | ||
"height": 100 | ||
}, | ||
{ | ||
"url": "https://sun9-55.userapi.com/c206720/v206720589/5bf1a/b9y9DjU-MTw.jpg", | ||
"width": 150, | ||
"height": 150 | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "7309583_1192042", | ||
"type": "50x50", | ||
"images": [ | ||
{ | ||
"url": "https://sun9-52.userapi.com/c206720/v206720589/5bf18/rvkrqEdlGKU.jpg", | ||
"width": 50, | ||
"height": 50 | ||
}, | ||
{ | ||
"url": "https://sun9-46.userapi.com/c206720/v206720589/5bf19/bq6UxajBZPQ.jpg", | ||
"width": 100, | ||
"height": 100 | ||
}, | ||
{ | ||
"url": "https://sun9-55.userapi.com/c206720/v206720589/5bf1a/b9y9DjU-MTw.jpg", | ||
"width": 150, | ||
"height": 150 | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "7309583_1192047", | ||
"type": "50x50", | ||
"images": [ | ||
{ | ||
"url": "https://sun9-52.userapi.com/c206720/v206720589/5bf18/rvkrqEdlGKU.jpg", | ||
"width": 50, | ||
"height": 50 | ||
}, | ||
{ | ||
"url": "https://sun9-46.userapi.com/c206720/v206720589/5bf19/bq6UxajBZPQ.jpg", | ||
"width": 100, | ||
"height": 100 | ||
}, | ||
{ | ||
"url": "https://sun9-55.userapi.com/c206720/v206720589/5bf1a/b9y9DjU-MTw.jpg", | ||
"width": 150, | ||
"height": 150 | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "7309583_1192053", | ||
"type": "50x50", | ||
"images": [ | ||
{ | ||
"url": "https://sun9-52.userapi.com/c206720/v206720589/5bf18/rvkrqEdlGKU.jpg", | ||
"width": 50, | ||
"height": 50 | ||
}, | ||
{ | ||
"url": "https://sun9-46.userapi.com/c206720/v206720589/5bf19/bq6UxajBZPQ.jpg", | ||
"width": 100, | ||
"height": 100 | ||
}, | ||
{ | ||
"url": "https://sun9-55.userapi.com/c206720/v206720589/5bf1a/b9y9DjU-MTw.jpg", | ||
"width": 150, | ||
"height": 150 | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "7309583_1192090", | ||
"type": "50x50", | ||
"images": [ | ||
{ | ||
"url": "https://sun9-52.userapi.com/c206720/v206720589/5bf18/rvkrqEdlGKU.jpg", | ||
"width": 50, | ||
"height": 50 | ||
}, | ||
{ | ||
"url": "https://sun9-46.userapi.com/c206720/v206720589/5bf19/bq6UxajBZPQ.jpg", | ||
"width": 100, | ||
"height": 100 | ||
}, | ||
{ | ||
"url": "https://sun9-55.userapi.com/c206720/v206720589/5bf1a/b9y9DjU-MTw.jpg", | ||
"width": 150, | ||
"height": 150 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
VkNet.Tests/TestData/Categories/AppWidgets/GetGroupImageUploadServer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"response": { | ||
"upload_url": "some_url" | ||
} | ||
} |
Oops, something went wrong.