From 0273bb85e9ebfda606caf5949ad7af29421deb9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=BD=D1=8E=D1=82=D0=B8=D0=BD=20=D0=9C=D0=B0=D0=BA?= =?UTF-8?q?=D1=81=D0=B8=D0=BC=20=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B5?= =?UTF-8?q?=D0=B2=D0=B8=D1=87?= Date: Sun, 3 Oct 2021 16:20:32 +0300 Subject: [PATCH] =?UTF-8?q?#1167=20=D0=9F=D0=B5=D1=80=D0=B5=D0=B2=D0=BE?= =?UTF-8?q?=D0=B4=D0=B8=D1=82=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BA=20*.Should().NotBeNull()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Assert.NotNull(result); к settings.Should().NotBeNull(); - Assert.IsNotNull(callMethod); к callMethod.Should().NotBeNull(); --- .../Categories/Account/AccountCategoryTest.cs | 3 ++- VkNet.Tests/Categories/Ads/AdsCheckLinkTests.cs | 3 ++- .../AppWidgets/GetAppImageUploadServerTest.cs | 5 +++-- .../Categories/AppWidgets/GetAppImagesTest.cs | 3 ++- .../AppWidgets/GetGroupImageUploadServerTest.cs | 5 +++-- .../Categories/AppWidgets/GetGroupImagesTest.cs | 3 ++- .../Categories/AppWidgets/GetImagesByIdTest.cs | 3 ++- .../Categories/AppWidgets/SaveAppImageTest.cs | 3 ++- .../Categories/AppWidgets/SaveGroupImageTest.cs | 3 ++- VkNet.Tests/Categories/Apps/AppsTest.cs | 7 ++++--- .../Categories/Audio/AudioCreatePlaylistTest.cs | 3 ++- .../Audio/AudioGetBroadcastListTest.cs | 3 ++- .../Categories/Audio/AudioGetByIdTest.cs | 3 ++- .../Categories/Audio/AudioGetCatalogTest.cs | 5 +++-- .../Categories/Audio/AudioGetPlaylistsTest.cs | 3 ++- .../Audio/AudioGetRecommendationsTest.cs | 3 ++- VkNet.Tests/Categories/Audio/AudioGetTest.cs | 3 ++- .../Categories/Audio/AudiogGetPopularTest.cs | 3 ++- .../Categories/Audio/GetPlaylistByIdTest.cs | 3 ++- .../BotsLongPoll/BotsLongPollMessageTest.cs | 9 +++++---- VkNet.Tests/Categories/Docs/DocsSaveTests.cs | 5 +++-- VkNet.Tests/Categories/Donut/DonutTests.cs | 5 +++-- VkNet.Tests/Categories/Fave/FaveAddTagTests.cs | 3 ++- VkNet.Tests/Categories/Fave/FaveCategoryTest.cs | 9 +++++---- .../Categories/Fave/FaveGetPagesTests.cs | 3 ++- VkNet.Tests/Categories/Fave/FaveGetTagsTests.cs | 3 ++- VkNet.Tests/Categories/Fave/FaveGetTests.cs | 3 ++- .../Categories/Friends/FriendsCategoryTest.cs | 3 ++- .../Categories/Friends/FriendsGetRequests.cs | 7 ++++--- .../Categories/Friends/FriendsGetSuggestions.cs | 7 ++++--- VkNet.Tests/Categories/Group/CreateTest.cs | 5 +++-- .../Group/GetLongPollSettingsTests.cs | 3 ++- VkNet.Tests/Categories/Group/GetMembersTests.cs | 3 ++- .../Categories/Group/GetRequestsTests.cs | 9 +++++---- .../Categories/Group/GroupsCategoryTest.cs | 7 ++++--- .../Categories/LeadForms/LeadFormsTests.cs | 13 +++++++------ .../Categories/Leads/LeadsCategoryTests.cs | 9 +++++---- .../Categories/Messages/MessagesCategoryTest.cs | 3 ++- .../Categories/Messages/MessagesGetByIdTests.cs | 3 ++- .../Messages/MessagesGetChatPreview.cs | 5 +++-- .../MessagesGetImportantMessagesTests.cs | 3 ++- .../Messages/MessagesGetRecentCallsTests.cs | 3 ++- .../Categories/Messages/MessagesPinTests.cs | 3 ++- .../Categories/Messages/MessagesSendTests.cs | 3 ++- VkNet.Tests/Categories/NewsFeed/GetTest.cs | 7 ++++--- VkNet.Tests/Categories/NewsFeed/SearchTests.cs | 9 +++++---- .../Categories/Notes/NotesCategoryTests.cs | 5 +++-- .../OrdersGetUserSubscriptionByIdTests.cs | 3 ++- .../Podcasts/ClearRecentSearchesTest.cs | 4 ++-- .../Categories/Podcasts/GetPopularTest.cs | 5 +++-- .../Podcasts/GetRecentSearchRequestsTest.cs | 5 +++-- VkNet.Tests/Categories/Podcasts/SearchTest.cs | 5 +++-- .../Categories/Polls/PollsGetByIdTests.cs | 3 ++- .../Categories/PrettyCards/CreateTest.cs | 5 +++-- .../Categories/PrettyCards/DeleteTest.cs | 5 +++-- VkNet.Tests/Categories/PrettyCards/EditTest.cs | 5 +++-- .../Categories/PrettyCards/GetByIdTest.cs | 3 ++- VkNet.Tests/Categories/PrettyCards/GetTest.cs | 5 +++-- VkNet.Tests/Categories/Search/SearchTests.cs | 5 +++-- VkNet.Tests/Categories/Secure/SecureTests.cs | 5 +++-- VkNet.Tests/Categories/Stats/StatsTest.cs | 7 ++++--- .../Categories/Storage/StorageCategoryTests.cs | 7 ++++--- .../Streaming/StreamingCategoryTests.cs | 7 ++++--- .../Categories/Utils/UtilsCategoryTest.cs | 17 +++++++++-------- .../Categories/Video/VideoCategoryTest.cs | 15 ++++++++------- .../Categories/Wall/WallGetCommentsTests.cs | 3 ++- VkNet.Tests/Categories/Wall/WallGetTests.cs | 13 +++++++------ .../AuthorizationFormHtmlParserTests.cs | 11 ++++++----- VkNet.Tests/Infrastructure/ImplicitFlowTests.cs | 3 ++- .../ImplicitFlowVkAuthorizationTests.cs | 3 ++- VkNet.Tests/Models/ConversationModelTests.cs | 13 +++++++------ VkNet.Tests/Models/GeoTests.cs | 7 ++++--- VkNet.Tests/Models/MessageTemplateTests.cs | 5 +++-- .../AttachmentJsonConverterTests.cs | 7 ++++--- .../DateTimeToStringFormatConverterTests.cs | 5 +++-- VkNet.Tests/VkApiTest.cs | 5 +++-- VkNet.Tests/VkApiVersionManagerTests.cs | 5 +++-- 77 files changed, 242 insertions(+), 166 deletions(-) diff --git a/VkNet.Tests/Categories/Account/AccountCategoryTest.cs b/VkNet.Tests/Categories/Account/AccountCategoryTest.cs index edd997430..294d7f96b 100644 --- a/VkNet.Tests/Categories/Account/AccountCategoryTest.cs +++ b/VkNet.Tests/Categories/Account/AccountCategoryTest.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Categories; using VkNet.Enums; @@ -193,7 +194,7 @@ public void GetPrivacySettings() var settings = Api.Account.GetPrivacySettings(); // Assert - Assert.NotNull(settings); + settings.Should().NotBeNull(); Assert.IsNotEmpty(settings.Sections); Assert.IsNotEmpty(settings.Settings); Assert.IsNotEmpty(settings.SupportedCategories); diff --git a/VkNet.Tests/Categories/Ads/AdsCheckLinkTests.cs b/VkNet.Tests/Categories/Ads/AdsCheckLinkTests.cs index 550b7768b..ac01d0501 100644 --- a/VkNet.Tests/Categories/Ads/AdsCheckLinkTests.cs +++ b/VkNet.Tests/Categories/Ads/AdsCheckLinkTests.cs @@ -1,4 +1,5 @@ using System; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums.SafetyEnums; using VkNet.Model.RequestParams.Ads; @@ -26,7 +27,7 @@ public void CheckLink() LinkUrl = new Uri(Url) }); - Assert.NotNull(link); + link.Should().NotBeNull(); Assert.IsNotEmpty(link.Description); Assert.That(link.Status, Is.EqualTo(LinkStatusType.Disallowed)); diff --git a/VkNet.Tests/Categories/AppWidgets/GetAppImageUploadServerTest.cs b/VkNet.Tests/Categories/AppWidgets/GetAppImageUploadServerTest.cs index 015e93fd3..164f68941 100644 --- a/VkNet.Tests/Categories/AppWidgets/GetAppImageUploadServerTest.cs +++ b/VkNet.Tests/Categories/AppWidgets/GetAppImageUploadServerTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Enums.SafetyEnums; using VkNet.Tests.Infrastructure; @@ -19,7 +20,7 @@ public void GetAppImageUploadServer() var result = Api.AppWidgets.GetAppImageUploadServer(AppWidgetImageType.FiftyOnFifty); - Assert.IsNotNull(result.UploadUrl); + result.UploadUrl.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/AppWidgets/GetAppImagesTest.cs b/VkNet.Tests/Categories/AppWidgets/GetAppImagesTest.cs index 198b6da09..b7103f978 100644 --- a/VkNet.Tests/Categories/AppWidgets/GetAppImagesTest.cs +++ b/VkNet.Tests/Categories/AppWidgets/GetAppImagesTest.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums.SafetyEnums; using VkNet.Tests.Infrastructure; @@ -20,7 +21,7 @@ public void GetAppImages() var result = Api.AppWidgets.GetAppImages(0, 10, AppWidgetImageType.FiftyOnFifty); - Assert.IsNotNull(result.Items.First().Images.First().Url); + result.Items.First().Images.First().Url.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/AppWidgets/GetGroupImageUploadServerTest.cs b/VkNet.Tests/Categories/AppWidgets/GetGroupImageUploadServerTest.cs index e5c39700f..602ed07f9 100644 --- a/VkNet.Tests/Categories/AppWidgets/GetGroupImageUploadServerTest.cs +++ b/VkNet.Tests/Categories/AppWidgets/GetGroupImageUploadServerTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Enums.SafetyEnums; using VkNet.Tests.Infrastructure; @@ -19,7 +20,7 @@ public void GetGroupImageUploadServer() var result = Api.AppWidgets.GetGroupImageUploadServer(AppWidgetImageType.FiftyOnFifty); - Assert.IsNotNull(result.UploadUrl); + result.UploadUrl.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/AppWidgets/GetGroupImagesTest.cs b/VkNet.Tests/Categories/AppWidgets/GetGroupImagesTest.cs index f55f606b8..869d00a37 100644 --- a/VkNet.Tests/Categories/AppWidgets/GetGroupImagesTest.cs +++ b/VkNet.Tests/Categories/AppWidgets/GetGroupImagesTest.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums.SafetyEnums; using VkNet.Tests.Infrastructure; @@ -20,7 +21,7 @@ public void GetGroupImages() var result = Api.AppWidgets.GetGroupImages(0, 10, AppWidgetImageType.FiftyOnFifty); - Assert.IsNotNull(result.Items.First().Images.First().Url); + result.Items.First().Images.First().Url.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/AppWidgets/GetImagesByIdTest.cs b/VkNet.Tests/Categories/AppWidgets/GetImagesByIdTest.cs index 5cc6a1024..252ac7c26 100644 --- a/VkNet.Tests/Categories/AppWidgets/GetImagesByIdTest.cs +++ b/VkNet.Tests/Categories/AppWidgets/GetImagesByIdTest.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -19,7 +20,7 @@ public void GetAppImages() var result = Api.AppWidgets.GetImagesById("7309583_1192027"); - Assert.IsNotNull(result); + result.Should().NotBeNull(); Assert.AreEqual("7309583_1192027", result.First().Id); } } diff --git a/VkNet.Tests/Categories/AppWidgets/SaveAppImageTest.cs b/VkNet.Tests/Categories/AppWidgets/SaveAppImageTest.cs index bb02ae091..d0755f485 100644 --- a/VkNet.Tests/Categories/AppWidgets/SaveAppImageTest.cs +++ b/VkNet.Tests/Categories/AppWidgets/SaveAppImageTest.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -21,7 +22,7 @@ public void SaveAppImage() "0f009dbdd6154c88b8", "eyJvaWQiOjczMDk1ODMsInR5cGUiOjUsInBob3RvIjp7InBob3RvIjoiMjRkNmQwOWU1ZXgiLCJzaXplcyI6W1siYSIsMjA2NzIwNTg5LCI1YmYxOCIsInJ2a3JxRWRsR0tVIiw1MCw1MF0sWyJiIiwyMDY3MjA1ODksIjViZjE5IiwiYnE2VXhhakJaUFEiLDEwMCwxMDBdLFsiYyIsMjA2NzIwNTg5LCI1YmYxYSIsImI5eTlEalUtTVR3IiwxNTAsMTUwXV0sImtpZCI6IjhlMDkzZjYxOGQyY2M5MzJiMDU5YmRlYTViNjVhYmNhIiwiZGVidWciOiJ4Y2MiLCJ1cmxzIjpbInYyMDY3MjA1ODlcLzViZjE4XC9ydmtycUVkbEdLVS5qcGciLCJ2MjA2NzIwNTg5XC81YmYxOVwvYnE2VXhhakJaUFEuanBnIiwidjIwNjcyMDU4OVwvNWJmMWFcL2I5eTlEalUtTVR3LmpwZyJdfSwiYndhY3QiOiJhcHBfd2lkZ2V0X2ltYWdlIiwic2VydmVyIjoyMDY3MjAsIm1pZCI6MCwiX3NpZyI6ImNhMjI3ZWZlY2MxMjhjMzgxNTYzZjBjOGQ4YTM4ZTJlIn0"); - Assert.IsNotNull(result.Images.First().Url); + result.Images.First().Url.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/AppWidgets/SaveGroupImageTest.cs b/VkNet.Tests/Categories/AppWidgets/SaveGroupImageTest.cs index f984ddd00..8bd422625 100644 --- a/VkNet.Tests/Categories/AppWidgets/SaveGroupImageTest.cs +++ b/VkNet.Tests/Categories/AppWidgets/SaveGroupImageTest.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -21,7 +22,7 @@ public void SaveGroupImage() "0f009dbdd6154c88b8", "eyJvaWQiOjczMDk1ODMsInR5cGUiOjUsInBob3RvIjp7InBob3RvIjoiMjRkNmQwOWU1ZXgiLCJzaXplcyI6W1siYSIsMjA2NzIwNTg5LCI1YmYxOCIsInJ2a3JxRWRsR0tVIiw1MCw1MF0sWyJiIiwyMDY3MjA1ODksIjViZjE5IiwiYnE2VXhhakJaUFEiLDEwMCwxMDBdLFsiYyIsMjA2NzIwNTg5LCI1YmYxYSIsImI5eTlEalUtTVR3IiwxNTAsMTUwXV0sImtpZCI6IjhlMDkzZjYxOGQyY2M5MzJiMDU5YmRlYTViNjVhYmNhIiwiZGVidWciOiJ4Y2MiLCJ1cmxzIjpbInYyMDY3MjA1ODlcLzViZjE4XC9ydmtycUVkbEdLVS5qcGciLCJ2MjA2NzIwNTg5XC81YmYxOVwvYnE2VXhhakJaUFEuanBnIiwidjIwNjcyMDU4OVwvNWJmMWFcL2I5eTlEalUtTVR3LmpwZyJdfSwiYndhY3QiOiJhcHBfd2lkZ2V0X2ltYWdlIiwic2VydmVyIjoyMDY3MjAsIm1pZCI6MCwiX3NpZyI6ImNhMjI3ZWZlY2MxMjhjMzgxNTYzZjBjOGQ4YTM4ZTJlIn0"); - Assert.IsNotNull(result.Images.First().Url); + result.Images.First().Url.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Apps/AppsTest.cs b/VkNet.Tests/Categories/Apps/AppsTest.cs index e527f675f..299643e04 100644 --- a/VkNet.Tests/Categories/Apps/AppsTest.cs +++ b/VkNet.Tests/Categories/Apps/AppsTest.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums.Filters; using VkNet.Enums.SafetyEnums; @@ -84,7 +85,7 @@ public void GetLeaderboard_Extended() var app = Api.Apps.GetLeaderboard(AppRatingType.Points, null, true); - Assert.IsNotNull(app); + app.Should().NotBeNull(); Assert.That(app.Count, Is.EqualTo(130)); Assert.That(app.Items, Is.Not.Empty); Assert.That(app.Items[0].Score, Is.EqualTo(221634238)); @@ -101,7 +102,7 @@ public void GetLeaderboard_Level() var app = Api.Apps.GetLeaderboard(AppRatingType.Level); - Assert.IsNotNull(app); + app.Should().NotBeNull(); Assert.That(app.Count, Is.EqualTo(130)); Assert.That(app.Items, Is.Not.Empty); Assert.That(app.Items[0].Score, Is.EqualTo(221634238)); @@ -117,7 +118,7 @@ public void GetLeaderboard_Points() var app = Api.Apps.GetLeaderboard(AppRatingType.Points); - Assert.IsNotNull(app); + app.Should().NotBeNull(); Assert.That(app.Count, Is.EqualTo(130)); Assert.That(app.Items, Is.Not.Empty); Assert.That(app.Items[0].Score, Is.EqualTo(221634238)); diff --git a/VkNet.Tests/Categories/Audio/AudioCreatePlaylistTest.cs b/VkNet.Tests/Categories/Audio/AudioCreatePlaylistTest.cs index 6cf1db596..673a0056f 100644 --- a/VkNet.Tests/Categories/Audio/AudioCreatePlaylistTest.cs +++ b/VkNet.Tests/Categories/Audio/AudioCreatePlaylistTest.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -19,7 +20,7 @@ public void CreatePlaylistTest() var result = Api.Audio.CreatePlaylist(123456789, "test title", "test description", new List { "123456789_123456789" }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.That(result.Id, Is.EqualTo(11)); Assert.That(result.OwnerId, Is.EqualTo(123456789)); Assert.That(result.Title, Is.EqualTo("test title")); diff --git a/VkNet.Tests/Categories/Audio/AudioGetBroadcastListTest.cs b/VkNet.Tests/Categories/Audio/AudioGetBroadcastListTest.cs index 2d558110f..c1d8ec185 100644 --- a/VkNet.Tests/Categories/Audio/AudioGetBroadcastListTest.cs +++ b/VkNet.Tests/Categories/Audio/AudioGetBroadcastListTest.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -21,7 +22,7 @@ public void GetBroadcastListTest() var firstOrDefault = result.FirstOrDefault(); Assert.IsNotEmpty(result); - Assert.NotNull(firstOrDefault); + firstOrDefault.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Audio/AudioGetByIdTest.cs b/VkNet.Tests/Categories/Audio/AudioGetByIdTest.cs index 23523a94b..5c0b40e1e 100644 --- a/VkNet.Tests/Categories/Audio/AudioGetByIdTest.cs +++ b/VkNet.Tests/Categories/Audio/AudioGetByIdTest.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -22,7 +23,7 @@ public void GetByIdTest() var audio = result.FirstOrDefault(); Assert.IsNotEmpty(result); - Assert.NotNull(audio); + audio.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Audio/AudioGetCatalogTest.cs b/VkNet.Tests/Categories/Audio/AudioGetCatalogTest.cs index 7261e6947..bb24365ef 100644 --- a/VkNet.Tests/Categories/Audio/AudioGetCatalogTest.cs +++ b/VkNet.Tests/Categories/Audio/AudioGetCatalogTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Enums.Filters; using VkNet.Enums.SafetyEnums; using VkNet.Tests.Infrastructure; @@ -20,7 +21,7 @@ public void GetCatalog() var result = Api.Audio.GetCatalog(20, true, UsersFields.FirstNameGen| UsersFields.Photo100); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(result.Items[0].Type, AudioCatalogType.AudiosSpecial); Assert.AreEqual(result.Items[0].Source, AudioCatalogSourceType.RecomsRecoms); Assert.AreEqual(result.Items[0].Thumbs[0].Width, 300); diff --git a/VkNet.Tests/Categories/Audio/AudioGetPlaylistsTest.cs b/VkNet.Tests/Categories/Audio/AudioGetPlaylistsTest.cs index f4f0c4ef4..597c7a23c 100644 --- a/VkNet.Tests/Categories/Audio/AudioGetPlaylistsTest.cs +++ b/VkNet.Tests/Categories/Audio/AudioGetPlaylistsTest.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -22,7 +23,7 @@ public void GetPlaylistsTest() Assert.That(result.TotalCount, Is.EqualTo(3)); Assert.IsNotEmpty(result); - Assert.NotNull(playlist); + playlist.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Audio/AudioGetRecommendationsTest.cs b/VkNet.Tests/Categories/Audio/AudioGetRecommendationsTest.cs index b2d99e10e..b9433f33a 100644 --- a/VkNet.Tests/Categories/Audio/AudioGetRecommendationsTest.cs +++ b/VkNet.Tests/Categories/Audio/AudioGetRecommendationsTest.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -21,7 +22,7 @@ public void GetRecommendationsTest() var audio = result.FirstOrDefault(); Assert.IsNotEmpty(result); - Assert.NotNull(audio); + audio.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Audio/AudioGetTest.cs b/VkNet.Tests/Categories/Audio/AudioGetTest.cs index 794e26da7..1d159114e 100644 --- a/VkNet.Tests/Categories/Audio/AudioGetTest.cs +++ b/VkNet.Tests/Categories/Audio/AudioGetTest.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Model.RequestParams; using VkNet.Tests.Infrastructure; @@ -27,7 +28,7 @@ public void GetTest() Assert.IsNotEmpty(result); Assert.That(result.Count, Is.EqualTo(1)); - Assert.NotNull(audio); + audio.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Audio/AudiogGetPopularTest.cs b/VkNet.Tests/Categories/Audio/AudiogGetPopularTest.cs index d514c09d9..1768ec152 100644 --- a/VkNet.Tests/Categories/Audio/AudiogGetPopularTest.cs +++ b/VkNet.Tests/Categories/Audio/AudiogGetPopularTest.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -21,7 +22,7 @@ public void GetGetPopularTest() var audio = response.FirstOrDefault(); Assert.IsNotEmpty(response); - Assert.NotNull(audio); + audio.Should().NotBeNull(); Assert.That(audio.Id, Is.EqualTo(456240861)); } } diff --git a/VkNet.Tests/Categories/Audio/GetPlaylistByIdTest.cs b/VkNet.Tests/Categories/Audio/GetPlaylistByIdTest.cs index bd30ab513..0e7e52460 100644 --- a/VkNet.Tests/Categories/Audio/GetPlaylistByIdTest.cs +++ b/VkNet.Tests/Categories/Audio/GetPlaylistByIdTest.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -16,7 +17,7 @@ public void GetPlaylistByIdTestTest() var result = Api.Audio.GetPlaylistById(-77288583, 84820009); - Assert.NotNull(result); + result.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/BotsLongPoll/BotsLongPollMessageTest.cs b/VkNet.Tests/Categories/BotsLongPoll/BotsLongPollMessageTest.cs index 8207a410f..1d3d1e152 100644 --- a/VkNet.Tests/Categories/BotsLongPoll/BotsLongPollMessageTest.cs +++ b/VkNet.Tests/Categories/BotsLongPoll/BotsLongPollMessageTest.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums; using VkNet.Model.RequestParams; @@ -29,9 +30,9 @@ public void GetBotsLongPollHistory_MessageNewTest() var clientInfo = messageNew?.ClientInfo; - Assert.NotNull(messageNew); - Assert.NotNull(message); - Assert.NotNull(clientInfo); + messageNew.Should().NotBeNull(); + message.Should().NotBeNull(); + clientInfo.Should().NotBeNull(); Assert.IsNotEmpty(clientInfo.ButtonActions); Assert.True(clientInfo.Keyboard); @@ -154,7 +155,7 @@ public void GetBotsLongPollHistory_MessageEventTest() var messageEvent = update.MessageEvent; - Assert.NotNull(messageEvent); + messageEvent.Should().NotBeNull(); Assert.AreEqual("feleyinek", messageEvent.EventId); Assert.AreEqual(123456789, messageEvent.UserId); Assert.AreEqual(123456789, messageEvent.PeerId); diff --git a/VkNet.Tests/Categories/Docs/DocsSaveTests.cs b/VkNet.Tests/Categories/Docs/DocsSaveTests.cs index 020f7d65b..1cf8bf9d4 100644 --- a/VkNet.Tests/Categories/Docs/DocsSaveTests.cs +++ b/VkNet.Tests/Categories/Docs/DocsSaveTests.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums; using VkNet.Model.Attachments; @@ -62,9 +63,9 @@ public void Save_Type() Assert.IsNotEmpty(result); var item = result.FirstOrDefault(); - Assert.NotNull(item); + item.Should().NotBeNull(); var doc = item.Instance as Document; - Assert.NotNull(doc); + doc.Should().NotBeNull(); Assert.AreEqual(DocumentTypeEnum.Text, doc.Type); } } diff --git a/VkNet.Tests/Categories/Donut/DonutTests.cs b/VkNet.Tests/Categories/Donut/DonutTests.cs index 6c3b04de7..fb839d070 100644 --- a/VkNet.Tests/Categories/Donut/DonutTests.cs +++ b/VkNet.Tests/Categories/Donut/DonutTests.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using NUnit.Framework; using VkNet.Enums.Filters; using VkNet.Exception; @@ -24,7 +25,7 @@ public void GetFriends() Url = "https://api.vk.com/method/donut.getFriends"; ReadJsonFile(JsonPaths.EmptyArray); var result = Api.Donut.GetFriends(-173151748, 0, 3, new UsersFields()); - Assert.NotNull(result); + result.Should().NotBeNull(); } [Test] @@ -40,7 +41,7 @@ public void GetSubscriptions() { Url = "https://api.vk.com/method/donut.getSubscriptions"; ReadCategoryJsonPath(nameof(GetSubscriptions)); - Assert.NotNull(Api.Donut.GetSubscriptions(new UsersFields(), 1, 1)); + Api.Donut.GetSubscriptions(new UsersFields(), 1, 1).Should().NotBeNull(); } } } diff --git a/VkNet.Tests/Categories/Fave/FaveAddTagTests.cs b/VkNet.Tests/Categories/Fave/FaveAddTagTests.cs index 1a904362f..418af45eb 100644 --- a/VkNet.Tests/Categories/Fave/FaveAddTagTests.cs +++ b/VkNet.Tests/Categories/Fave/FaveAddTagTests.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -17,7 +18,7 @@ public void AddTag() var tag = Api.Fave.AddTag("Важное", null); - Assert.NotNull(tag); + tag.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Fave/FaveCategoryTest.cs b/VkNet.Tests/Categories/Fave/FaveCategoryTest.cs index 399d14e45..2f10144ce 100644 --- a/VkNet.Tests/Categories/Fave/FaveCategoryTest.cs +++ b/VkNet.Tests/Categories/Fave/FaveCategoryTest.cs @@ -1,6 +1,7 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums; using VkNet.Enums.SafetyEnums; @@ -43,7 +44,7 @@ public void GetMarketItems_AllParams() var marketItems = Api.Fave.GetMarketItems(1, 0, true); - Assert.NotNull(marketItems); + marketItems.Should().NotBeNull(); Assert.That(marketItems.TotalCount, Is.EqualTo(1)); CollectionAssert.IsNotEmpty(marketItems); } @@ -56,7 +57,7 @@ public void GetMarketItems_count() var marketItems = Api.Fave.GetMarketItems(1); - Assert.NotNull(marketItems); + marketItems.Should().NotBeNull(); Assert.That(marketItems.TotalCount, Is.EqualTo(1)); CollectionAssert.IsNotEmpty(marketItems); } @@ -69,7 +70,7 @@ public void GetMarketItems_countAndOffset() var marketItems = Api.Fave.GetMarketItems(1, 0); - Assert.NotNull(marketItems); + marketItems.Should().NotBeNull(); Assert.That(marketItems.TotalCount, Is.EqualTo(1)); CollectionAssert.IsNotEmpty(marketItems); } @@ -82,7 +83,7 @@ public void GetMarketItems_WithoutParams() var marketItems = Api.Fave.GetMarketItems(); - Assert.NotNull(marketItems); + marketItems.Should().NotBeNull(); Assert.That(marketItems.TotalCount, Is.EqualTo(1)); CollectionAssert.IsNotEmpty(marketItems); } diff --git a/VkNet.Tests/Categories/Fave/FaveGetPagesTests.cs b/VkNet.Tests/Categories/Fave/FaveGetPagesTests.cs index ffc69f3ea..0b946f394 100644 --- a/VkNet.Tests/Categories/Fave/FaveGetPagesTests.cs +++ b/VkNet.Tests/Categories/Fave/FaveGetPagesTests.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums.SafetyEnums; using VkNet.Tests.Infrastructure; @@ -20,7 +21,7 @@ public void GetPages() var page = pages.FirstOrDefault(); Assert.IsTrue(pages.Any()); - Assert.NotNull(page); + page.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Fave/FaveGetTagsTests.cs b/VkNet.Tests/Categories/Fave/FaveGetTagsTests.cs index 3b7265b6e..c7b9d9316 100644 --- a/VkNet.Tests/Categories/Fave/FaveGetTagsTests.cs +++ b/VkNet.Tests/Categories/Fave/FaveGetTagsTests.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -20,7 +21,7 @@ public void GetTags() var tag = tags.FirstOrDefault(); Assert.IsNotEmpty(tags); - Assert.NotNull(tag); + tag.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Fave/FaveGetTests.cs b/VkNet.Tests/Categories/Fave/FaveGetTests.cs index 98a648026..97081481f 100644 --- a/VkNet.Tests/Categories/Fave/FaveGetTests.cs +++ b/VkNet.Tests/Categories/Fave/FaveGetTests.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Model.RequestParams.Fave; using VkNet.Tests.Infrastructure; @@ -21,7 +22,7 @@ public void Get() var fave = faves.FirstOrDefault(); Assert.IsTrue(faves.Any()); - Assert.NotNull(fave); + fave.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Friends/FriendsCategoryTest.cs b/VkNet.Tests/Categories/Friends/FriendsCategoryTest.cs index 256272b7c..7631123a3 100644 --- a/VkNet.Tests/Categories/Friends/FriendsCategoryTest.cs +++ b/VkNet.Tests/Categories/Friends/FriendsCategoryTest.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Categories; using VkNet.Enums; @@ -87,7 +88,7 @@ public void AreFriends_FourTypes_RightFriendStatuses() 3505305 }); - Assert.NotNull(dict); + dict.Should().NotBeNull(); Assert.That(dict.Count, Is.EqualTo(4)); Assert.That(dict.FirstOrDefault()?.FriendStatus, Is.EqualTo(FriendStatus.NotFriend)); Assert.That(dict.Skip(1).FirstOrDefault()?.FriendStatus, Is.EqualTo(FriendStatus.Friend)); diff --git a/VkNet.Tests/Categories/Friends/FriendsGetRequests.cs b/VkNet.Tests/Categories/Friends/FriendsGetRequests.cs index 3e52fe439..de6d379cb 100644 --- a/VkNet.Tests/Categories/Friends/FriendsGetRequests.cs +++ b/VkNet.Tests/Categories/Friends/FriendsGetRequests.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Model.RequestParams; using VkNet.Tests.Infrastructure; @@ -18,7 +19,7 @@ public void DefaultParams() ReadCategoryJsonPath(nameof(Api.Friends.GetRequests)); var result = Api.Friends.GetRequests(new FriendsGetRequestsParams()); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(1, result.Count); } @@ -34,7 +35,7 @@ public void Extended() Extended = true }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(1, result.Count); } } diff --git a/VkNet.Tests/Categories/Friends/FriendsGetSuggestions.cs b/VkNet.Tests/Categories/Friends/FriendsGetSuggestions.cs index 3aa36d2ef..0ca46f8a9 100644 --- a/VkNet.Tests/Categories/Friends/FriendsGetSuggestions.cs +++ b/VkNet.Tests/Categories/Friends/FriendsGetSuggestions.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums; using VkNet.Enums.Filters; @@ -22,10 +23,10 @@ public void GetSuggestions_AllParameters() var result = Api.Friends.GetSuggestions(FriendsFilter.Mutual, 1, 0, UsersFields.Sex, NameCase.Gen); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(182, result.TotalCount); var user = result.FirstOrDefault(); - Assert.NotNull(user); + user.Should().NotBeNull(); Assert.AreEqual(Sex.Male, user.Sex); } @@ -37,7 +38,7 @@ public void GetSuggestions_WithoutParameters() ReadCategoryJsonPath(nameof(Api.Friends.GetSuggestions)); var result = Api.Friends.GetSuggestions(); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(182, result.TotalCount); } } diff --git a/VkNet.Tests/Categories/Group/CreateTest.cs b/VkNet.Tests/Categories/Group/CreateTest.cs index a17b60de5..6a06cb9bc 100644 --- a/VkNet.Tests/Categories/Group/CreateTest.cs +++ b/VkNet.Tests/Categories/Group/CreateTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Tests.Infrastructure; namespace VkNet.Tests.Categories.Group @@ -18,7 +19,7 @@ public void Create() var result = Api.Groups.Create("Test_Group"); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(true, result.IsMember); } } diff --git a/VkNet.Tests/Categories/Group/GetLongPollSettingsTests.cs b/VkNet.Tests/Categories/Group/GetLongPollSettingsTests.cs index dc0a581e8..817c062b9 100644 --- a/VkNet.Tests/Categories/Group/GetLongPollSettingsTests.cs +++ b/VkNet.Tests/Categories/Group/GetLongPollSettingsTests.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -21,7 +22,7 @@ public void GetLongPollSettings() Assert.AreEqual("5.50", result.ApiVersion); Assert.IsTrue(result.IsEnabled); - Assert.NotNull(result.Events); + result.Events.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Group/GetMembersTests.cs b/VkNet.Tests/Categories/Group/GetMembersTests.cs index 663b8c95d..55b47f643 100644 --- a/VkNet.Tests/Categories/Group/GetMembersTests.cs +++ b/VkNet.Tests/Categories/Group/GetMembersTests.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using NUnit.Framework; using VkNet.Enums.SafetyEnums; using VkNet.Model.RequestParams; @@ -24,7 +25,7 @@ public void GetMembers() GroupId = "187905748" }); - Assert.NotNull(result); + result.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Group/GetRequestsTests.cs b/VkNet.Tests/Categories/Group/GetRequestsTests.cs index f1daa0e43..db087535d 100644 --- a/VkNet.Tests/Categories/Group/GetRequestsTests.cs +++ b/VkNet.Tests/Categories/Group/GetRequestsTests.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using NUnit.Framework; using VkNet.Enums.Filters; using VkNet.Tests.Infrastructure; @@ -17,10 +18,10 @@ public void GetRequests_With_Fields() var result = Api.Groups.GetRequests(1, null, null, UsersFields.LastSeen); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(3, result.Count); foreach (var user in result) - Assert.NotNull(user); + user.Should().NotBeNull(); } [Test] @@ -32,10 +33,10 @@ public void GetRequests_Without_Fields() var result = Api.Groups.GetRequests(1); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(3, result.Count); foreach (var user in result) - Assert.NotNull(user); + user.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Group/GroupsCategoryTest.cs b/VkNet.Tests/Categories/Group/GroupsCategoryTest.cs index 9e3991270..68c732935 100644 --- a/VkNet.Tests/Categories/Group/GroupsCategoryTest.cs +++ b/VkNet.Tests/Categories/Group/GroupsCategoryTest.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Categories; using VkNet.Enums; @@ -356,7 +357,7 @@ public void GetById_NormalCaseAllFields_ReturnTwoItems() var group = Api.Groups.GetById(new List(), "17683660", GroupsFields.All).FirstOrDefault(); - Assert.NotNull(group); + @group.Should().NotBeNull(); Assert.That(group.Id, Is.EqualTo(17683660)); Assert.That(group.Name, Is.EqualTo("Творческие каникулы ART CAMP с 21 по 29 июля")); Assert.That(group.ScreenName, Is.EqualTo("club17683660")); @@ -395,7 +396,7 @@ public void GetById_NormalCaseDefaultFields_ReturnTwoItems() var g = Api.Groups.GetById(new List(), "17683660", null).FirstOrDefault(); - Assert.NotNull(g); + g.Should().NotBeNull(); Assert.That(g.Id, Is.EqualTo(17683660)); Assert.That(g.Name, Is.EqualTo("Творческие каникулы ART CAMP с 21 по 29 июля")); Assert.That(g.ScreenName, Is.EqualTo("club17683660")); @@ -554,7 +555,7 @@ public void GetCatalogInfo() var catalogInfo = Api.Groups.GetCatalogInfo(); - Assert.NotNull(catalogInfo); + catalogInfo.Should().NotBeNull(); Assert.That(catalogInfo.Enabled, Is.True); CollectionAssert.IsNotEmpty(catalogInfo.Categories); Assert.That(catalogInfo.Categories.Count(), Is.EqualTo(13)); diff --git a/VkNet.Tests/Categories/LeadForms/LeadFormsTests.cs b/VkNet.Tests/Categories/LeadForms/LeadFormsTests.cs index 4baa2ccf9..8b387d0a0 100644 --- a/VkNet.Tests/Categories/LeadForms/LeadFormsTests.cs +++ b/VkNet.Tests/Categories/LeadForms/LeadFormsTests.cs @@ -1,4 +1,5 @@ using System; +using FluentAssertions; using NUnit.Framework; using VkNet.Model.LeadForms; using VkNet.Tests.Infrastructure; @@ -26,7 +27,7 @@ public void Create() PolicyLinkUrl = "ya.ru" }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(1, result.FormId); Assert.AreEqual(new Uri("https://vk.com/apform_id=1#form_id=1"), result.Url); } @@ -38,7 +39,7 @@ public void Delete() ReadCategoryJsonPath(nameof(Delete)); var result = Api.LeadForms.Delete(103292418, 1); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(1, result.FormId); } @@ -49,7 +50,7 @@ public void Get() ReadCategoryJsonPath(nameof(Get)); var result = Api.LeadForms.Get(103292418, 1); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(2, result.FormId); } @@ -60,7 +61,7 @@ public void List() ReadCategoryJsonPath(nameof(List)); var result = Api.LeadForms.List(103292418); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.IsNotEmpty(result); } @@ -72,7 +73,7 @@ public void GetUploadUrl() var result = Api.LeadForms.GetUploadURL(); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(new Uri("https://pu.vk.com1d95424ffe4e4983a6a"), result); } @@ -92,7 +93,7 @@ public void Update() PolicyLinkUrl = "ya.ru" }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(2, result.FormId); Assert.AreEqual(new Uri("https://vk.com/apform_id=2#form_id=2"), result.Url); } diff --git a/VkNet.Tests/Categories/Leads/LeadsCategoryTests.cs b/VkNet.Tests/Categories/Leads/LeadsCategoryTests.cs index ca59748fb..9691f1942 100644 --- a/VkNet.Tests/Categories/Leads/LeadsCategoryTests.cs +++ b/VkNet.Tests/Categories/Leads/LeadsCategoryTests.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Model.RequestParams.Leads; using VkNet.Tests.Infrastructure; @@ -17,7 +18,7 @@ public void Complete() var result = Api.Leads.Complete("test8f4f23fb62c5c89fbb", "bb4f37150027a9cf51", string.Empty); - Assert.IsNotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(1000, result.Limit); Assert.AreEqual(500, result.DayLimit); Assert.AreEqual(10, result.Spent); @@ -34,7 +35,7 @@ public void Start() var result = Api.Leads.Start(new StartParams()); - Assert.IsNotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(1, result.TestMode); Assert.AreEqual("vk_sid", result.VkSid); } @@ -47,7 +48,7 @@ public void GetUsers() var result = Api.Leads.GetUsers(new GetUsersParams()); - Assert.IsNotNull(result); + result.Should().NotBeNull(); Assert.IsNotEmpty(result); } } diff --git a/VkNet.Tests/Categories/Messages/MessagesCategoryTest.cs b/VkNet.Tests/Categories/Messages/MessagesCategoryTest.cs index c168bfdb9..97d9733a8 100644 --- a/VkNet.Tests/Categories/Messages/MessagesCategoryTest.cs +++ b/VkNet.Tests/Categories/Messages/MessagesCategoryTest.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums; using VkNet.Enums.Filters; @@ -547,7 +548,7 @@ public void Search_NormalCase_Messages() var msgs = result.Items; Assert.That(result.Count, Is.EqualTo(18)); - Assert.NotNull(msgs); + msgs.Should().NotBeNull(); Assert.That(msgs.Count, Is.EqualTo(3)); Assert.That(msgs[2].Id, Is.EqualTo(131291)); diff --git a/VkNet.Tests/Categories/Messages/MessagesGetByIdTests.cs b/VkNet.Tests/Categories/Messages/MessagesGetByIdTests.cs index 54ebc9d9b..41906b468 100644 --- a/VkNet.Tests/Categories/Messages/MessagesGetByIdTests.cs +++ b/VkNet.Tests/Categories/Messages/MessagesGetByIdTests.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; namespace VkNet.Tests.Categories.Messages @@ -22,7 +23,7 @@ public void AdminAuthorId() }); var message = result.FirstOrDefault(); - Assert.NotNull(message); + message.Should().NotBeNull(); Assert.AreEqual(45, message.AdminAuthorId); } } diff --git a/VkNet.Tests/Categories/Messages/MessagesGetChatPreview.cs b/VkNet.Tests/Categories/Messages/MessagesGetChatPreview.cs index b5de40269..6e749f684 100644 --- a/VkNet.Tests/Categories/Messages/MessagesGetChatPreview.cs +++ b/VkNet.Tests/Categories/Messages/MessagesGetChatPreview.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Enums.Filters; namespace VkNet.Tests.Categories.Messages @@ -15,7 +16,7 @@ public void DefaultParams() var result = Api.Messages.GetChatPreview("http://vk.com", ProfileFields.About); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.That(result.Emails, Is.Not.Empty); Assert.That(result.Groups, Is.Not.Empty); Assert.That(result.Profiles, Is.Not.Empty); diff --git a/VkNet.Tests/Categories/Messages/MessagesGetImportantMessagesTests.cs b/VkNet.Tests/Categories/Messages/MessagesGetImportantMessagesTests.cs index 8e8c5d63f..c0b3f898c 100644 --- a/VkNet.Tests/Categories/Messages/MessagesGetImportantMessagesTests.cs +++ b/VkNet.Tests/Categories/Messages/MessagesGetImportantMessagesTests.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using NUnit.Framework; using VkNet.Model.RequestParams; @@ -14,7 +15,7 @@ public void GetImportantMessagesResult() var result = Api.Messages.GetImportantMessages(new GetImportantMessagesParams()); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.IsNotEmpty(result.Messages); Assert.IsNotEmpty(result.Profiles); Assert.IsNotEmpty(result.Conversations); diff --git a/VkNet.Tests/Categories/Messages/MessagesGetRecentCallsTests.cs b/VkNet.Tests/Categories/Messages/MessagesGetRecentCallsTests.cs index d7ef03c15..ce118828b 100644 --- a/VkNet.Tests/Categories/Messages/MessagesGetRecentCallsTests.cs +++ b/VkNet.Tests/Categories/Messages/MessagesGetRecentCallsTests.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using NUnit.Framework; namespace VkNet.Tests.Categories.Messages @@ -13,7 +14,7 @@ public void GetRecentCalls() var result = Api.Messages.GetRecentCalls(new[] { "filter" }, 1); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.IsNotEmpty(result.Messages); Assert.IsNotEmpty(result.Profiles); } diff --git a/VkNet.Tests/Categories/Messages/MessagesPinTests.cs b/VkNet.Tests/Categories/Messages/MessagesPinTests.cs index 5861be15b..06281a65c 100644 --- a/VkNet.Tests/Categories/Messages/MessagesPinTests.cs +++ b/VkNet.Tests/Categories/Messages/MessagesPinTests.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using NUnit.Framework; namespace VkNet.Tests.Categories.Messages @@ -14,7 +15,7 @@ public void Pin() var result = Api.Messages.Pin(123, 345); - Assert.NotNull(result); + result.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Messages/MessagesSendTests.cs b/VkNet.Tests/Categories/Messages/MessagesSendTests.cs index 5a32cd1df..0a884151a 100644 --- a/VkNet.Tests/Categories/Messages/MessagesSendTests.cs +++ b/VkNet.Tests/Categories/Messages/MessagesSendTests.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Categories; using VkNet.Enums.SafetyEnums; @@ -183,7 +184,7 @@ public void MessagesSendToUserIds_NoSetUserIdsParam_ArrayResult() Assert.IsNotEmpty(result); var message = result.FirstOrDefault(); - Assert.NotNull(message); + message.Should().NotBeNull(); Assert.AreEqual(32190123, message.PeerId); Assert.AreEqual(210525, message.MessageId); } diff --git a/VkNet.Tests/Categories/NewsFeed/GetTest.cs b/VkNet.Tests/Categories/NewsFeed/GetTest.cs index 2148e3c2b..65c8ef581 100644 --- a/VkNet.Tests/Categories/NewsFeed/GetTest.cs +++ b/VkNet.Tests/Categories/NewsFeed/GetTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Enums.Filters; using VkNet.Model.RequestParams; using VkNet.Tests.Infrastructure; @@ -24,7 +25,7 @@ public void Get() Count = 100 }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.IsNotEmpty(result.NextFrom); } @@ -41,7 +42,7 @@ public void Get2() Count = 100 }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.IsNotEmpty(result.NextFrom); } } diff --git a/VkNet.Tests/Categories/NewsFeed/SearchTests.cs b/VkNet.Tests/Categories/NewsFeed/SearchTests.cs index 13ef854cf..733ef8dba 100644 --- a/VkNet.Tests/Categories/NewsFeed/SearchTests.cs +++ b/VkNet.Tests/Categories/NewsFeed/SearchTests.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using System.Linq; +using FluentAssertions; using VkNet.Model.RequestParams; using VkNet.Tests.Infrastructure; @@ -19,7 +20,7 @@ public void Search_NextFrom_NotNull() var result = Api.NewsFeed.Search(new NewsFeedSearchParams()); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.IsNotEmpty(result.NextFrom); } @@ -35,7 +36,7 @@ public void Search_Coordinates_Exception() Count = 20 }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.IsNotEmpty(result.NextFrom); } @@ -52,10 +53,10 @@ public void Search_PostSourceData_Parsing() Count = 20 }); - Assert.NotNull(result); + result.Should().NotBeNull(); var first = result.Items.First(); - Assert.NotNull(first.PostSource.Data); + first.PostSource.Data.Should().NotBeNull(); var second = result.Items.Last(); Assert.IsNull(second.PostSource.Data); diff --git a/VkNet.Tests/Categories/Notes/NotesCategoryTests.cs b/VkNet.Tests/Categories/Notes/NotesCategoryTests.cs index 4536c068f..fdd55ec97 100644 --- a/VkNet.Tests/Categories/Notes/NotesCategoryTests.cs +++ b/VkNet.Tests/Categories/Notes/NotesCategoryTests.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Model.RequestParams.Notes; using VkNet.Tests.Infrastructure; @@ -95,7 +96,7 @@ public void GetById() var result = Api.Notes.GetById(new NotesGetByIdParams()); - Assert.IsNotNull(result); + result.Should().NotBeNull(); } [Test] diff --git a/VkNet.Tests/Categories/Orders/OrdersGetUserSubscriptionByIdTests.cs b/VkNet.Tests/Categories/Orders/OrdersGetUserSubscriptionByIdTests.cs index d461cde0d..3f5642f87 100644 --- a/VkNet.Tests/Categories/Orders/OrdersGetUserSubscriptionByIdTests.cs +++ b/VkNet.Tests/Categories/Orders/OrdersGetUserSubscriptionByIdTests.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -17,7 +18,7 @@ public void GetUserSubscriptionById() var result = Api.Orders.GetUserSubscriptionById(123, 234); - Assert.IsNotNull(result); + result.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Podcasts/ClearRecentSearchesTest.cs b/VkNet.Tests/Categories/Podcasts/ClearRecentSearchesTest.cs index bfcbd9a1f..944410fcd 100644 --- a/VkNet.Tests/Categories/Podcasts/ClearRecentSearchesTest.cs +++ b/VkNet.Tests/Categories/Podcasts/ClearRecentSearchesTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Tests.Infrastructure; namespace VkNet.Tests.Categories.Podcasts @@ -18,7 +19,6 @@ public void ClearRecentSearches() var result = Api.Podcasts.ClearRecentSearches(); - Assert.NotNull(result); Assert.AreEqual(result, true); } } diff --git a/VkNet.Tests/Categories/Podcasts/GetPopularTest.cs b/VkNet.Tests/Categories/Podcasts/GetPopularTest.cs index 340f53199..300acf6c6 100644 --- a/VkNet.Tests/Categories/Podcasts/GetPopularTest.cs +++ b/VkNet.Tests/Categories/Podcasts/GetPopularTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Tests.Infrastructure; namespace VkNet.Tests.Categories.Podcasts @@ -18,7 +19,7 @@ public void GetPopular() var result = Api.Podcasts.GetPopular(); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(result[0].OwnerId, -74962618); Assert.AreEqual(result[1].OwnerTitle, "вДудь"); } diff --git a/VkNet.Tests/Categories/Podcasts/GetRecentSearchRequestsTest.cs b/VkNet.Tests/Categories/Podcasts/GetRecentSearchRequestsTest.cs index 484c4694a..1c12e1043 100644 --- a/VkNet.Tests/Categories/Podcasts/GetRecentSearchRequestsTest.cs +++ b/VkNet.Tests/Categories/Podcasts/GetRecentSearchRequestsTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Tests.Infrastructure; namespace VkNet.Tests.Categories.Podcasts @@ -18,7 +19,7 @@ public void GetRecentSearchRequests() var result = Api.Podcasts.GetRecentSearchRequests(); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(result[0], "navi"); Assert.AreEqual(result[1], "ted"); } diff --git a/VkNet.Tests/Categories/Podcasts/SearchTest.cs b/VkNet.Tests/Categories/Podcasts/SearchTest.cs index eae3402d8..523c1f099 100644 --- a/VkNet.Tests/Categories/Podcasts/SearchTest.cs +++ b/VkNet.Tests/Categories/Podcasts/SearchTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Model.RequestParams; using VkNet.Tests.Infrastructure; @@ -24,7 +25,7 @@ public void Search() Count = 100 }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(result.Podcasts[0].OwnerId, -189167851); Assert.AreEqual(result.Episodes[0].Id, 456239643); Assert.AreEqual(result.Groups[0].Id, 189167851); diff --git a/VkNet.Tests/Categories/Polls/PollsGetByIdTests.cs b/VkNet.Tests/Categories/Polls/PollsGetByIdTests.cs index ee0f096b2..840192fa2 100644 --- a/VkNet.Tests/Categories/Polls/PollsGetByIdTests.cs +++ b/VkNet.Tests/Categories/Polls/PollsGetByIdTests.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using NUnit.Framework; using VkNet.Model.RequestParams; using VkNet.Tests.Infrastructure; @@ -21,7 +22,7 @@ public void GetById() PollId = 123 }); - Assert.NotNull(result); + result.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/PrettyCards/CreateTest.cs b/VkNet.Tests/Categories/PrettyCards/CreateTest.cs index ac3c75c8e..5610d552b 100644 --- a/VkNet.Tests/Categories/PrettyCards/CreateTest.cs +++ b/VkNet.Tests/Categories/PrettyCards/CreateTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Enums.SafetyEnums; using VkNet.Model.RequestParams; using VkNet.Tests.Infrastructure; @@ -29,7 +30,7 @@ public void Create() Button = Button.Call }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(result.CardId, "545435"); Assert.AreEqual(result.OwnerId, -126102803); } diff --git a/VkNet.Tests/Categories/PrettyCards/DeleteTest.cs b/VkNet.Tests/Categories/PrettyCards/DeleteTest.cs index d901a50dc..4c7e9724b 100644 --- a/VkNet.Tests/Categories/PrettyCards/DeleteTest.cs +++ b/VkNet.Tests/Categories/PrettyCards/DeleteTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Model.RequestParams; using VkNet.Tests.Infrastructure; @@ -23,7 +24,7 @@ public void Delete() CardId = "1488" }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(result.CardId, "1488"); Assert.AreEqual(result.OwnerId, -126102803); } diff --git a/VkNet.Tests/Categories/PrettyCards/EditTest.cs b/VkNet.Tests/Categories/PrettyCards/EditTest.cs index 9e5ed3cc8..33bcf8fed 100644 --- a/VkNet.Tests/Categories/PrettyCards/EditTest.cs +++ b/VkNet.Tests/Categories/PrettyCards/EditTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Model.RequestParams; using VkNet.Tests.Infrastructure; @@ -23,7 +24,7 @@ public void Edit() CardId = "1488" }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(result.CardId, "1488"); Assert.AreEqual(result.OwnerId, -126102803); } diff --git a/VkNet.Tests/Categories/PrettyCards/GetByIdTest.cs b/VkNet.Tests/Categories/PrettyCards/GetByIdTest.cs index ec72ebf40..a11810117 100644 --- a/VkNet.Tests/Categories/PrettyCards/GetByIdTest.cs +++ b/VkNet.Tests/Categories/PrettyCards/GetByIdTest.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using FluentAssertions; using NUnit.Framework; using VkNet.Model.RequestParams; using VkNet.Tests.Infrastructure; @@ -31,7 +32,7 @@ public void GetById() CardIds = list, }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(result[0].CardId, "7037403"); Assert.AreEqual(result[2].Images[0].Url, new Uri("https://vk.com/8Jseb63OJSE.jpg")); } diff --git a/VkNet.Tests/Categories/PrettyCards/GetTest.cs b/VkNet.Tests/Categories/PrettyCards/GetTest.cs index e845f6341..4030cdd6b 100644 --- a/VkNet.Tests/Categories/PrettyCards/GetTest.cs +++ b/VkNet.Tests/Categories/PrettyCards/GetTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Model.RequestParams; using VkNet.Tests.Infrastructure; @@ -24,7 +25,7 @@ public void Get() Count = 100 }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(result[0].CardId, "7037403"); Assert.AreEqual(result[1].PriceOld, "123.00"); } diff --git a/VkNet.Tests/Categories/Search/SearchTests.cs b/VkNet.Tests/Categories/Search/SearchTests.cs index da3a03fcf..ae05474f4 100644 --- a/VkNet.Tests/Categories/Search/SearchTests.cs +++ b/VkNet.Tests/Categories/Search/SearchTests.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Model.RequestParams; using VkNet.Tests.Infrastructure; @@ -18,7 +19,7 @@ public void GetHints() var result = Api.Search.GetHints(new SearchGetHintsParams()); - Assert.NotNull(result); + result.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Secure/SecureTests.cs b/VkNet.Tests/Categories/Secure/SecureTests.cs index def678f85..31ccfd4ca 100644 --- a/VkNet.Tests/Categories/Secure/SecureTests.cs +++ b/VkNet.Tests/Categories/Secure/SecureTests.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Tests.Infrastructure; @@ -28,7 +29,7 @@ public void CheckToken() var app = Api.Secure.CheckToken("access_token", ""); - Assert.IsNotNull(app); + app.Should().NotBeNull(); } [Test] @@ -52,7 +53,7 @@ public void GetSmsHistory() Assert.IsNotEmpty(app); var item = app.FirstOrDefault(); - Assert.NotNull(item); + item.Should().NotBeNull(); Assert.AreEqual(1238497, item.Id); } diff --git a/VkNet.Tests/Categories/Stats/StatsTest.cs b/VkNet.Tests/Categories/Stats/StatsTest.cs index ea0f460e9..6e2a892a1 100644 --- a/VkNet.Tests/Categories/Stats/StatsTest.cs +++ b/VkNet.Tests/Categories/Stats/StatsTest.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics.CodeAnalysis; +using FluentAssertions; using NUnit.Framework; using VkNet.Model; using VkNet.Tests.Infrastructure; @@ -31,7 +32,7 @@ public void GetByApp_NormalCase() DateTimeKind.Utc) }); - Assert.NotNull(statsPeriods[0]); + statsPeriods[0].Should().NotBeNull(); Assert.That(new DateTime(2013, 09, 08), Is.EqualTo(statsPeriods[0].PeriodFrom)); } @@ -53,7 +54,7 @@ public void GetByGroup_EmptyActivityCase() DateTimeKind.Utc) }); - Assert.NotNull(statsPeriods[0]); + statsPeriods[0].Should().NotBeNull(); Assert.Null(statsPeriods[0].Activity); Assert.That(new DateTime(2013, 09, 08), Is.EqualTo(statsPeriods[0].PeriodFrom)); @@ -77,7 +78,7 @@ public void GetByGroup_NormalCase() DateTimeKind.Utc) }); - Assert.NotNull(statsPeriods[0]); + statsPeriods[0].Should().NotBeNull(); Assert.That(new DateTime(2013, 09, 08), Is.EqualTo(statsPeriods[0].PeriodFrom)); } diff --git a/VkNet.Tests/Categories/Storage/StorageCategoryTests.cs b/VkNet.Tests/Categories/Storage/StorageCategoryTests.cs index 136dc972e..6e5c6043d 100644 --- a/VkNet.Tests/Categories/Storage/StorageCategoryTests.cs +++ b/VkNet.Tests/Categories/Storage/StorageCategoryTests.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Tests.Infrastructure; namespace VkNet.Tests.Categories.Storage @@ -17,7 +18,7 @@ public void Get() var result = Api.Storage.Get(new[] { "qwe" }); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.IsNotEmpty(result); } @@ -29,7 +30,7 @@ public void GetKeys() var result = Api.Storage.GetKeys(); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.IsNotEmpty(result); } diff --git a/VkNet.Tests/Categories/Streaming/StreamingCategoryTests.cs b/VkNet.Tests/Categories/Streaming/StreamingCategoryTests.cs index 4ab6ff7b1..a68bc40da 100644 --- a/VkNet.Tests/Categories/Streaming/StreamingCategoryTests.cs +++ b/VkNet.Tests/Categories/Streaming/StreamingCategoryTests.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums.SafetyEnums; using VkNet.Tests.Infrastructure; @@ -19,7 +20,7 @@ public void GetServerUrl() var result = Api.Streaming.GetServerUrl(); - Assert.IsNotNull(result); + result.Should().NotBeNull(); Assert.AreEqual("streaming.vk.com", result.Endpoint); Assert.AreEqual("be8d29c05546e58cb52420aaf2b9f51f0a440f89", result.Key); } @@ -32,7 +33,7 @@ public void GetSettings() var result = Api.Streaming.GetSettings(); - Assert.IsNotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(MonthlyLimit.Tier6, result.MonthlyLimit); } @@ -47,7 +48,7 @@ public void GetStats() Assert.IsNotEmpty(result); var stats = result.FirstOrDefault(); - Assert.NotNull(stats); + stats.Should().NotBeNull(); Assert.AreEqual(StreamingEventType.Post, stats.EventType); Assert.IsNotEmpty(stats.Stats); } diff --git a/VkNet.Tests/Categories/Utils/UtilsCategoryTest.cs b/VkNet.Tests/Categories/Utils/UtilsCategoryTest.cs index a0efbecc2..6752379db 100644 --- a/VkNet.Tests/Categories/Utils/UtilsCategoryTest.cs +++ b/VkNet.Tests/Categories/Utils/UtilsCategoryTest.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums; using VkNet.Enums.SafetyEnums; @@ -73,7 +74,7 @@ public void GetLastShortenedLinks() var result = Api.Utils.GetLastShortenedLinks(); - Assert.NotNull(result); + result.Should().NotBeNull(); } [Test] @@ -84,26 +85,26 @@ public void GetLinksStats() var result = Api.Utils.GetLinkStats(new LinkStatsParams()); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.That(result.Key, Is.EqualTo("6drK78")); Assert.That(result.Stats, Is.Not.Empty); var stat = result.Stats.FirstOrDefault(); - Assert.NotNull(stat); + stat.Should().NotBeNull(); Assert.That(stat.Views, Is.EqualTo(1)); Assert.That(stat.Timestamp, Is.EqualTo(VkResponse.TimestampToDateTime(1489309200))); var sexAge = stat.SexAge.FirstOrDefault(); - Assert.NotNull(sexAge); + sexAge.Should().NotBeNull(); Assert.That(sexAge.AgeRange, Is.EqualTo("18-21")); Assert.That(sexAge.Female, Is.EqualTo(2)); Assert.That(sexAge.Male, Is.EqualTo(1)); var country = stat.Countries.FirstOrDefault(); - Assert.NotNull(country); + country.Should().NotBeNull(); Assert.That(country.CountryId, Is.EqualTo(1)); Assert.That(country.Views, Is.EqualTo(1)); var city = stat.Cities.FirstOrDefault(); - Assert.NotNull(city); + city.Should().NotBeNull(); Assert.That(city.CityId, Is.EqualTo(1)); Assert.That(city.Views, Is.EqualTo(1)); } @@ -127,7 +128,7 @@ public void GetShortLink() var result = Api.Utils.GetShortLink(new Uri("http://google.ru"), false); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.That(result.ShortUrl, Is.EqualTo(new Uri("https://vk.cc/7dMDvY"))); Assert.That(result.Url, Is.EqualTo(new Uri("http://google.ru"))); Assert.That(result.Key, Is.EqualTo("7dMDvY")); @@ -141,7 +142,7 @@ public void ResolveScreenName() var result = Api.Utils.ResolveScreenName("durov"); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(result.Type, VkObjectType.User); Assert.That(result.Id, Is.EqualTo(1)); } diff --git a/VkNet.Tests/Categories/Video/VideoCategoryTest.cs b/VkNet.Tests/Categories/Video/VideoCategoryTest.cs index bcc527e85..c381b9247 100644 --- a/VkNet.Tests/Categories/Video/VideoCategoryTest.cs +++ b/VkNet.Tests/Categories/Video/VideoCategoryTest.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums; using VkNet.Enums.Filters; @@ -146,9 +147,9 @@ public void Get_Extended() var video = result.FirstOrDefault(); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(1, result.Count); - Assert.NotNull(video); + video.Should().NotBeNull(); Assert.AreEqual(456245310, video.Id); Assert.AreEqual(-129440544, video.OwnerId); Assert.AreEqual("ec", video.Title); @@ -163,15 +164,15 @@ public void Get_Extended() Assert.IsFalse(video.IsFavorite); Assert.AreEqual(DateHelper.TimeStampToDateTime(1569151132), video.AddingDate); Assert.IsTrue(video.Repeat); - Assert.NotNull(video.Files); + video.Files.Should().NotBeNull(); Assert.AreEqual(new Uri("https://vk.com/vi/dec_GQ3DKNZUGI4TAMQ"), video.Player); Assert.True(video.CanAdd); Assert.True(video.CanComment); Assert.True(video.CanRepost); - Assert.NotNull(video.Likes); + video.Likes.Should().NotBeNull(); Assert.False(video.Likes.UserLikes); Assert.AreEqual(369, video.Likes.Count); - Assert.NotNull(video.Reposts); + video.Reposts.Should().NotBeNull(); Assert.False(video.Reposts.UserReposted); Assert.AreEqual(1, video.Reposts.Count); } @@ -256,9 +257,9 @@ public void GetAlbums_NormalCase_Extended() var result = Api.Video.GetAlbums(-129440544, extended: true, needSystem: true); var videoAlbum = result.FirstOrDefault(); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual(2, result.TotalCount); - Assert.NotNull(videoAlbum); + videoAlbum.Should().NotBeNull(); Assert.AreEqual(3790, videoAlbum.Count); Assert.AreEqual(-2, videoAlbum.Id); Assert.AreEqual(-129440544, videoAlbum.OwnerId); diff --git a/VkNet.Tests/Categories/Wall/WallGetCommentsTests.cs b/VkNet.Tests/Categories/Wall/WallGetCommentsTests.cs index e861a932a..ea03a0666 100644 --- a/VkNet.Tests/Categories/Wall/WallGetCommentsTests.cs +++ b/VkNet.Tests/Categories/Wall/WallGetCommentsTests.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using NUnit.Framework; using VkNet.Model.RequestParams; using VkNet.Tests.Infrastructure; @@ -24,7 +25,7 @@ public void GetComments802() Offset = 0 }); - Assert.NotNull(result); + result.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Categories/Wall/WallGetTests.cs b/VkNet.Tests/Categories/Wall/WallGetTests.cs index cb3702d63..2de4ef6a3 100644 --- a/VkNet.Tests/Categories/Wall/WallGetTests.cs +++ b/VkNet.Tests/Categories/Wall/WallGetTests.cs @@ -1,4 +1,5 @@ using System.Linq; +using FluentAssertions; using NUnit.Framework; using VkNet.Model.Attachments; using VkNet.Model.RequestParams; @@ -19,12 +20,12 @@ public void ArticleAttachement() var result = Api.Wall.Get(new WallGetParams()); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.That(result.TotalCount, Is.EqualTo(520)); var post = result.WallPosts.FirstOrDefault(); - Assert.NotNull(post); + post.Should().NotBeNull(); var attachment = post.Attachment.Instance as Article; - Assert.NotNull(attachment); + attachment.Should().NotBeNull(); Assert.That(attachment.Id, Is.EqualTo(10419)); } @@ -36,12 +37,12 @@ public void PodcastAttachment() var result = Api.Wall.Get(new WallGetParams()); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.That(result.TotalCount, Is.EqualTo(6352)); var post = result.WallPosts.FirstOrDefault(); - Assert.NotNull(post); + post.Should().NotBeNull(); var podcast = post.Attachments[1].Instance as Podcast; - Assert.NotNull(podcast); + podcast.Should().NotBeNull(); Assert.That(podcast.Id, Is.EqualTo(456240245)); } } diff --git a/VkNet.Tests/Infrastructure/AuthorizationFormHtmlParserTests.cs b/VkNet.Tests/Infrastructure/AuthorizationFormHtmlParserTests.cs index 9e92b59fa..1672b9c5b 100644 --- a/VkNet.Tests/Infrastructure/AuthorizationFormHtmlParserTests.cs +++ b/VkNet.Tests/Infrastructure/AuthorizationFormHtmlParserTests.cs @@ -3,6 +3,7 @@ using System.IO; using System.Text; using System.Threading.Tasks; +using FluentAssertions; using NUnit.Framework; using VkNet.Infrastructure.Authorization.ImplicitFlow; @@ -20,7 +21,7 @@ public async Task LoginForm() var parser = Mocker.CreateInstance(); var result = await parser.GetFormAsync(new Uri("https://m.vk.com/login?act=authcheck&m=442")); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual("post", result.Method); Assert.AreEqual("https://login.vk.com/?act=login&soft=1&utf8=1", result.Action); Assert.IsNotEmpty(result.Fields); @@ -35,11 +36,11 @@ public async Task CaptchaForm() var parser = Mocker.CreateInstance(); var result = await parser.GetFormAsync(new Uri("https://m.vk.com/login?act=authcheck&m=442")); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual("post", result.Method); Assert.AreEqual("https://login.vk.com/?act=login&soft=1&utf8=1", result.Action); - Assert.IsNotNull(result.UrlToCaptcha); + result.UrlToCaptcha.Should().NotBeNull(); var isCaptchaIndicated = result.UrlToCaptcha.Contains("captcha.php"); Assert.AreEqual(isCaptchaIndicated, true); @@ -56,7 +57,7 @@ public async Task TwoFaForm() var parser = Mocker.CreateInstance(); var result = await parser.GetFormAsync(new Uri("https://m.vk.com/login?act=authcheck&m=442")); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual("post", result.Method); Assert.AreEqual("https://m.vk.com/login?act=authcheck_code&hash=1552162040_c98f31a6e83d3c91c1", result.Action); Assert.IsNotEmpty(result.Fields); @@ -71,7 +72,7 @@ public async Task ConsentForm() var parser = Mocker.CreateInstance(); var result = await parser.GetFormAsync(new Uri("https://m.vk.com/login?act=authcheck&m=442")); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.AreEqual("post", result.Method); Assert.AreEqual("https://login.vk.com/?act=grant_access&client_id=4268118&settings=140492255&redirect_uri=https%3A%2F%2Foauth.vk.com%2Fblank.html&response_type=token&group_ids=&token_type=0&v=&state=123&display=mobile&ip_h=5a4524d95f3521be68&hash=1552162134_98614f6fce5d86d252&https=1", result.Action); diff --git a/VkNet.Tests/Infrastructure/ImplicitFlowTests.cs b/VkNet.Tests/Infrastructure/ImplicitFlowTests.cs index 3e9543212..6d67cb628 100644 --- a/VkNet.Tests/Infrastructure/ImplicitFlowTests.cs +++ b/VkNet.Tests/Infrastructure/ImplicitFlowTests.cs @@ -1,6 +1,7 @@ using System; using System.Text; using System.Threading.Tasks; +using FluentAssertions; using Moq; using Moq.AutoMock; using NUnit.Framework; @@ -102,7 +103,7 @@ public async Task Authorize() var result = await implicitFlow.AuthorizeAsync().ConfigureAwait(false); - Assert.NotNull(result); + result.Should().NotBeNull(); } [Test] diff --git a/VkNet.Tests/Infrastructure/ImplicitFlowVkAuthorizationTests.cs b/VkNet.Tests/Infrastructure/ImplicitFlowVkAuthorizationTests.cs index aa8146e0f..f8c635020 100644 --- a/VkNet.Tests/Infrastructure/ImplicitFlowVkAuthorizationTests.cs +++ b/VkNet.Tests/Infrastructure/ImplicitFlowVkAuthorizationTests.cs @@ -1,4 +1,5 @@ using System; +using FluentAssertions; using NUnit.Framework; using VkNet.Exception; using VkNet.Infrastructure.Authorization.ImplicitFlow; @@ -18,7 +19,7 @@ public void GetAuthorizationResult() var authorizationResult = auth.GetAuthorizationResult(url); - Assert.NotNull(authorizationResult); + authorizationResult.Should().NotBeNull(); Assert.AreEqual("123", authorizationResult.State); Assert.AreEqual(32190123, authorizationResult.UserId); Assert.AreEqual(86400, authorizationResult.ExpiresIn); diff --git a/VkNet.Tests/Models/ConversationModelTests.cs b/VkNet.Tests/Models/ConversationModelTests.cs index fd2e7004c..33d5058c0 100644 --- a/VkNet.Tests/Models/ConversationModelTests.cs +++ b/VkNet.Tests/Models/ConversationModelTests.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Enums.SafetyEnums; using VkNet.Model; using VkNet.Utils; @@ -15,8 +16,8 @@ public void ConversationModel() Url = "https://api.vk.com/method/friends.getRequests"; var conversation = Api.Call("friends.getRequests", VkParameters.Empty); - Assert.NotNull(conversation); - Assert.NotNull(conversation.Peer); + conversation.Should().NotBeNull(); + conversation.Peer.Should().NotBeNull(); Assert.AreEqual(2000000038, conversation.Peer.Id); Assert.AreEqual(ConversationPeerType.Chat, conversation.Peer.Type); Assert.AreEqual(38, conversation.Peer.LocalId); @@ -24,14 +25,14 @@ public void ConversationModel() Assert.AreEqual(115082, conversation.InRead); Assert.AreEqual(1210504, conversation.OutRead); Assert.AreEqual(7, conversation.UnreadCount); - Assert.NotNull(conversation.CanWrite); + conversation.CanWrite.Should().NotBeNull(); Assert.IsTrue(conversation.CanWrite.Allowed); Assert.IsTrue(conversation.CanReceiveMoney); - Assert.NotNull(conversation.ChatSettings); + conversation.ChatSettings.Should().NotBeNull(); Assert.AreEqual(321779994, conversation.ChatSettings.OwnerId); Assert.AreEqual("bug", conversation.ChatSettings.Title); Assert.AreEqual(ConversationChatSettingsState.In, conversation.ChatSettings.State); - Assert.NotNull(conversation.ChatSettings.Acl); + conversation.ChatSettings.Acl.Should().NotBeNull(); Assert.IsTrue(conversation.ChatSettings.Acl.CanChangeInfo); Assert.IsFalse(conversation.ChatSettings.Acl.CanChangeInviteLink); Assert.IsTrue(conversation.ChatSettings.Acl.CanChangePin); diff --git a/VkNet.Tests/Models/GeoTests.cs b/VkNet.Tests/Models/GeoTests.cs index 387c80142..edd236037 100644 --- a/VkNet.Tests/Models/GeoTests.cs +++ b/VkNet.Tests/Models/GeoTests.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Model; using VkNet.Utils; @@ -17,7 +18,7 @@ public void GeoFromJson() var geo = Geo.FromJson(response); - Assert.NotNull(geo); + geo.Should().NotBeNull(); } [Test] @@ -30,7 +31,7 @@ public void GeoJsonConvert() Url = "https://api.vk.com/method/friends.getRequests"; var result = Api.Call("friends.getRequests", VkParameters.Empty); - Assert.NotNull(result); + result.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Models/MessageTemplateTests.cs b/VkNet.Tests/Models/MessageTemplateTests.cs index 017bfd69c..c270feb80 100644 --- a/VkNet.Tests/Models/MessageTemplateTests.cs +++ b/VkNet.Tests/Models/MessageTemplateTests.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Model.Template; namespace VkNet.Tests.Models @@ -16,7 +17,7 @@ public void Template_Carousel() var result = MessageTemplate.FromJson(response); - Assert.IsNotNull(result); + result.Should().NotBeNull(); } } } \ No newline at end of file diff --git a/VkNet.Tests/Utils/JsonConverter/AttachmentJsonConverterTests.cs b/VkNet.Tests/Utils/JsonConverter/AttachmentJsonConverterTests.cs index f585632af..842450089 100644 --- a/VkNet.Tests/Utils/JsonConverter/AttachmentJsonConverterTests.cs +++ b/VkNet.Tests/Utils/JsonConverter/AttachmentJsonConverterTests.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using FluentAssertions; +using Newtonsoft.Json; using NUnit.Framework; using VkNet.Model; using VkNet.Utils; @@ -17,7 +18,7 @@ public void CallAndConvertToType() CommentBoard result = Api.Call("friends.getRequests", VkParameters.Empty); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.That(result.Id, Is.EqualTo(3)); Assert.That(result.FromId, Is.EqualTo(32190123)); Assert.IsNotEmpty(result.Attachments); @@ -40,7 +41,7 @@ public void SerializationTest() var result = JsonConvert.DeserializeObject(json); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.IsNotEmpty(result.Attachments); } } diff --git a/VkNet.Tests/Utils/JsonConverter/DateTimeToStringFormatConverterTests.cs b/VkNet.Tests/Utils/JsonConverter/DateTimeToStringFormatConverterTests.cs index 18ef53afc..619df7cfb 100644 --- a/VkNet.Tests/Utils/JsonConverter/DateTimeToStringFormatConverterTests.cs +++ b/VkNet.Tests/Utils/JsonConverter/DateTimeToStringFormatConverterTests.cs @@ -1,5 +1,6 @@ using System; using System.Globalization; +using FluentAssertions; using Newtonsoft.Json; using NUnit.Framework; using VkNet.Model.RequestParams; @@ -16,7 +17,7 @@ public void Deserialize() ReadJsonFile(nameof(JsonConverter), nameof(DateTimeToStringFormatConverter), nameof(Deserialize)); Url = "https://api.vk.com/method/friends.getRequests"; var result = Api.Call("friends.getRequests", VkParameters.Empty); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.That(result.Date, Is.EqualTo(new DateTime(2018, 11, 5))); } @@ -41,7 +42,7 @@ public void Serialization() var result = JsonConvert.DeserializeObject(json); - Assert.NotNull(result); + result.Should().NotBeNull(); var compare = string.Compare(json, Json, CultureInfo.InvariantCulture, CompareOptions.IgnoreSymbols); Assert.IsTrue(compare == 0); } diff --git a/VkNet.Tests/VkApiTest.cs b/VkNet.Tests/VkApiTest.cs index 1d68fc3ec..08c56a229 100644 --- a/VkNet.Tests/VkApiTest.cs +++ b/VkNet.Tests/VkApiTest.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using FluentAssertions; using NUnit.Framework; using VkNet.Enums; using VkNet.Enums.Filters; @@ -81,7 +82,7 @@ public void CallAndConvertToType() var result = Api.Call("friends.getRequests", VkParameters.Empty); - Assert.NotNull(result); + result.Should().NotBeNull(); Assert.That(result.UserId, Is.EqualTo(221634238)); Assert.That(result.Message, Is.EqualTo("text")); Assert.IsNotEmpty(result.Mutual); @@ -186,7 +187,7 @@ public void VkCallShouldBePublic() var callMethod = myArrayMethodInfo.FirstOrDefault(x => x.Name.Contains("Call")); // Assert - Assert.IsNotNull(callMethod); + callMethod.Should().NotBeNull(); Assert.IsTrue(callMethod.IsPublic); } diff --git a/VkNet.Tests/VkApiVersionManagerTests.cs b/VkNet.Tests/VkApiVersionManagerTests.cs index aab612460..666ac9f9c 100644 --- a/VkNet.Tests/VkApiVersionManagerTests.cs +++ b/VkNet.Tests/VkApiVersionManagerTests.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using FluentAssertions; +using NUnit.Framework; using VkNet.Abstractions.Core; using VkNet.Exception; using VkNet.Infrastructure; @@ -18,7 +19,7 @@ public VkApiVersionManagerTests() [Test] public void VersionIsNotEmpty() { - Assert.IsNotNull(Manager); + Manager.Should().NotBeNull(); Assert.IsFalse(string.IsNullOrWhiteSpace(Manager.Version)); }