Skip to content

Commit

Permalink
Renamed unit tests to Uniform naming (BenFradet#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
entvex authored Oct 5, 2020
1 parent 263cb5a commit 105acc9
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 104 deletions.
38 changes: 20 additions & 18 deletions RiotSharp.Test/CacheTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class CacheTest

[TestMethod]
[TestCategory("Cache")]
public void AddGet_TimeSpan_ShouldAddToTheCache_Test()
public void AddGet_TimeSpan_ShouldAddToTheCache_ReturnTrue()
{
Cache cache = new Cache();
cache.Add(CacheTestBase.TestKey, CacheTestBase.TestValue, new TimeSpan(0, 5, 0));
Expand All @@ -24,7 +24,7 @@ public void AddGet_TimeSpan_ShouldAddToTheCache_Test()

[TestMethod]
[TestCategory("Cache")]
public void AddGet_TimeSpan_ShouldAddAndExpire_Test()
public void AddGet_TimeSpan_ShouldAddAndExpire_ReturnTrue()
{
Cache cache = new Cache();
cache.Add(CacheTestBase.TestKey, CacheTestBase.TestValue, new TimeSpan(0, 0, 1));
Expand All @@ -36,7 +36,7 @@ public void AddGet_TimeSpan_ShouldAddAndExpire_Test()

[TestMethod]
[TestCategory("Cache")]
public void AddGet_DateTime_ShouldAdd_Test()
public void AddGet_DateTime_ShouldAdd_ReturnTheTestValue()
{
Cache cache = new Cache();
cache.Add(CacheTestBase.TestKey, CacheTestBase.TestValue, DateTime.Now + new TimeSpan(0, 5, 0));
Expand All @@ -46,7 +46,7 @@ public void AddGet_DateTime_ShouldAdd_Test()

[TestMethod]
[TestCategory("Cache")]
public void AddGet_DateTime_ShouldAddAndExpire_Test()
public void AddGet_DateTime_ShouldAddAndExpire_ReturnTrue()
{
Cache cache = new Cache();
cache.Add(CacheTestBase.TestKey, CacheTestBase.TestValue, DateTime.Now + new TimeSpan(0, 0, 1));
Expand All @@ -58,7 +58,7 @@ public void AddGet_DateTime_ShouldAddAndExpire_Test()

[TestMethod]
[TestCategory("Cache")]
public void Add_ShouldUpdateIfPresent_Test()
public void Add_ShouldUpdateIfPresent_ReturnUpdatedValue()
{
Cache cache = new Cache();
var otherValue = "otherValue";
Expand All @@ -71,7 +71,7 @@ public void Add_ShouldUpdateIfPresent_Test()

[TestMethod]
[TestCategory("Cache")]
public void Remove_ShouldDoNothingIfNull_Test()
public void Remove_ShouldDoNothingIfNull_ReturnDontThrowExceptionIfNull()
{
Cache cache = new Cache();
cache.Add(CacheTestBase.TestKey, CacheTestBase.TestValue, new TimeSpan(0, 0, 1));
Expand All @@ -83,16 +83,18 @@ public void Remove_ShouldDoNothingIfNull_Test()

[TestMethod]
[TestCategory("Cache")]
public void Remove_ShouldDoNothingIfAbsent_Test()
public void Remove_ShouldDoNothingIfAbsent_ReturnNull()
{
Cache cache = new Cache();
cache.Remove(CacheTestBase.TestKey);

cache.Get<string, string>(CacheTestBase.TestKey);
Assert.IsNull(cache.Get<string, string>(CacheTestBase.TestKey));
}

[TestMethod]
[TestCategory("Cache")]
public void Remove_ShouldRemoveIfPresent_Test()
public void Remove_ShouldRemoveIfPresent_ReturnNull()
{
Cache cache = new Cache();
cache.Add(CacheTestBase.TestKey, CacheTestBase.TestValue, new TimeSpan(0, 0, 1));
Expand All @@ -104,7 +106,7 @@ public void Remove_ShouldRemoveIfPresent_Test()

[TestMethod]
[TestCategory("Cache")]
public void Clear_ShouldRemoveAll_Test()
public void Clear_ShouldRemoveAll_ReturnNull()
{
Cache cache = new Cache();
cache.Add(CacheTestBase.TestKey, CacheTestBase.TestValue, new TimeSpan(0, 0, 1));
Expand All @@ -116,7 +118,7 @@ public void Clear_ShouldRemoveAll_Test()

[TestMethod]
[TestCategory("Cache")]
public void Keys_ShouldGetAllKeysOfType_Test()
public void Keys_ShouldGetAllKeysOfType_ReturnOneKeyTypeAndTheTestKey()
{
Cache cache = new Cache();
cache.Add(CacheTestBase.TestKey, CacheTestBase.TestValue, new TimeSpan(0, 0, 1));
Expand All @@ -129,7 +131,7 @@ public void Keys_ShouldGetAllKeysOfType_Test()

[TestMethod]
[TestCategory("Cache")]
public void Keys_ShouldGetEmptyOfTypeIfNoMatches_Test()
public void Keys_ShouldGetEmptyOfTypeIfNoMatches_ReturnTrue()
{
Cache cache = new Cache();
cache.Add(CacheTestBase.TestKey, CacheTestBase.TestValue, new TimeSpan(0, 0, 1));
Expand All @@ -141,7 +143,7 @@ public void Keys_ShouldGetEmptyOfTypeIfNoMatches_Test()

[TestMethod]
[TestCategory("Cache")]
public void Keys_ShouldGetAllKeys_Test()
public void Keys_ShouldGetAllKeys_ReturnContainTwoKeysAndTestKey()
{
Cache cache = new Cache();
cache.Add(CacheTestBase.TestKey, CacheTestBase.TestValue, new TimeSpan(0, 0, 1));
Expand All @@ -154,15 +156,15 @@ public void Keys_ShouldGetAllKeys_Test()

[TestMethod]
[TestCategory("Cache")]
public void Keys_ShouldGetEmptyIfEmptyCache_Test()
public void Keys_ShouldGetEmptyIfEmptyCache_ReturnTrue()
{
Cache cache = new Cache();
Assert.IsTrue(Enumerable.Empty<object>().SequenceEqual(cache.Keys()));
}

[TestMethod]
[TestCategory("Cache")]
public void Values_ShouldGetAllValuesOfType_Test()
public void Values_ShouldGetAllValuesOfType_ReturnContainOneTestKey()
{
Cache cache = new Cache();
cache.Add(CacheTestBase.TestKey, CacheTestBase.TestValue, new TimeSpan(0, 0, 1));
Expand All @@ -175,7 +177,7 @@ public void Values_ShouldGetAllValuesOfType_Test()

[TestMethod]
[TestCategory("Cache")]
public void Values_ShouldGetEmptyOfTypeIfNoMatches_Test()
public void Values_ShouldGetEmptyOfTypeIfNoMatches_ReturnTrue()
{
Cache cache = new Cache();
cache.Add(CacheTestBase.TestKey, CacheTestBase.TestValue, new TimeSpan(0, 0, 1));
Expand All @@ -187,7 +189,7 @@ public void Values_ShouldGetEmptyOfTypeIfNoMatches_Test()

[TestMethod]
[TestCategory("Cache")]
public void Values_ShouldGetAllValues_Test()
public void Values_ShouldGetAllValues_ReturnContainTwoTestValues()
{
Cache cache = new Cache();
cache.Add(CacheTestBase.TestKey, CacheTestBase.TestValue, new TimeSpan(0, 0, 1));
Expand All @@ -200,15 +202,15 @@ public void Values_ShouldGetAllValues_Test()

[TestMethod]
[TestCategory("Cache")]
public void Values_ShouldGetEmptyIfEmptyCache_Test()
public void Values_ShouldGetEmptyIfEmptyCache_ReturnTrue()
{
Cache cache = new Cache();
Assert.IsTrue(Enumerable.Empty<object>().SequenceEqual(cache.Values()));
}

[TestMethod]
[TestCategory("Cache")]
public void Count_ShouldGiveProperResults_Test()
public void Count_ShouldGiveProperResults_ReturnTheCorrectCounts()
{
Cache cache = new Cache();

Expand Down
45 changes: 22 additions & 23 deletions RiotSharp.Test/DataDragonApiTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,30 @@ public DataDragonApiTest()

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetChampionByKeyAsync_Test()
public async Task GetByKeyAsync_GetChampionByKeyAsync_ReturnAnnie()
{
await EnsureCredibilityAsync(async () =>
{
var champ = await _api.Champions.GetByKeyAsync(StaticChampionKey, StaticVersion);
Assert.AreEqual(StaticChampionName, champ.Name);
Assert.AreEqual(StaticChampionNameAnnie, champ.Name);
});
}

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetChampionByIdAsync_Test()
public async Task GetByIdAsync_GetChampionByIdAsync_ReturnAarox()
{
await EnsureCredibilityAsync(async () =>
{
var aatroxId = 266;
var champ = await _api.Champions.GetByIdAsync(aatroxId, StaticVersion);
Assert.AreEqual("Aatrox", champ.Name);
Assert.AreEqual(StaticChampionNameAatrox, champ.Name);
});
}

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetChampionsAsync_Test()
public async Task GetAllAsync_GetChampionsAsync_ReturnChampions()
{
await EnsureCredibilityAsync(async () =>
{
Expand All @@ -58,7 +58,7 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetChampionsAsync_Full_Test()
public async Task GetAllAsync_GetChampionsAsync_ReturnAChampionWithPassiveAndSpells()
{
await EnsureCredibilityAsync(async () =>
{
Expand All @@ -76,7 +76,7 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetItemsAsync_Test()
public async Task GetAllAsync_GetItems_ReturnAllItems()
{
await EnsureCredibilityAsync(async () =>
{
Expand All @@ -91,21 +91,20 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task JsonSerialize_ItemListStatic_Test()
public async Task SerializeObject_ItemListStatic_ReturnDeserializeList()
{
await EnsureCredibilityAsync(async () =>
{
// Arange
// Arrange
var itemsSample = await _api.Items.GetAllAsync(StaticVersion);
var itemSample = itemsSample.Items.First();

// Act
var itemsJson = JsonConvert.SerializeObject(itemsSample);

// Arange
var items = JsonConvert.DeserializeObject<Endpoints.StaticDataEndpoint.Item.ItemListStatic>(itemsJson);
var item = items.Items.First();


// Assert
Assert.AreEqual(itemsSample.Items.Count, items.Items.Count);
Assert.AreEqual(itemSample.Value.Id, item.Value.Id);
Assert.AreEqual(itemSample.Value.Name, item.Value.Name);
Expand All @@ -118,7 +117,7 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetLanguageStringsAsync_Test()
public async Task GetLanguageStringsAsync_GetLanguageStrings_ReturnLanguageStrings()
{
await EnsureCredibilityAsync(async () =>
{
Expand All @@ -133,7 +132,7 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetLanguagesAsync_Test()
public async Task GetLanguagesAsync_GetLanguages_ReturnLanguages()
{
await EnsureCredibilityAsync(async () =>
{
Expand All @@ -148,7 +147,7 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetMapsAsync_Test()
public async Task GetMapsAsync_GetsAllMaps_ReturnAllMaps()
{
await EnsureCredibilityAsync(async () =>
{
Expand All @@ -163,7 +162,7 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetMasteriesAsync_Test()
public async Task GetAllAsync_GetMasteriesAsync_ReturnAllMasteries()
{
await EnsureCredibilityAsync(async () =>
{
Expand All @@ -178,7 +177,7 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetProfileIconsAsync_Test()
public async Task GetAllAsync_GetProfileIconsAsync_ReturnAllProfileIcons()
{
await EnsureCredibilityAsync(async () =>
{
Expand All @@ -193,7 +192,7 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetReforgedRunesAsync_Test()
public async Task GetAllAsync_GetReforgedRunesAsync_ReturnAllReforgedRunes()
{
await EnsureCredibilityAsync(async () =>
{
Expand All @@ -208,7 +207,7 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetRunesAsync_Test()
public async Task GetAllAsync_GetRunesAsync_ReturnAllRunes()
{
await EnsureCredibilityAsync(async () =>
{
Expand All @@ -223,7 +222,7 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetSummonerSpellsAsync_Test()
public async Task GetAllAsync_GetSummonerSpellsAsync_ReturnAllSummonerSpells()
{
await EnsureCredibilityAsync(async () =>
{
Expand All @@ -238,7 +237,7 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetVersionsAsync_Test()
public async Task GetAllAsync_GetVersionsAsync_ReturnAllVersions()
{
await EnsureCredibilityAsync(async () =>
{
Expand All @@ -253,7 +252,7 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public async Task GetRealmAsync_Test()
public async Task GetAllAsync_GetRealmAsync_ReturnAllRealms()
{
await EnsureCredibilityAsync(async () =>
{
Expand All @@ -268,7 +267,7 @@ await EnsureCredibilityAsync(async () =>

[TestMethod]
[TestCategory(TestCategory), TestCategory("Async")]
public void GetTarballLink_Test()
public void Get_GetTarballLink_ReturnTarballLinks()
{
var tarballLink = _api.TarballLinks.Get(StaticVersion);
Assert.IsFalse(string.IsNullOrEmpty(tarballLink));
Expand Down
3 changes: 2 additions & 1 deletion RiotSharp.Test/DataDragonApiTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public class DataDragonApiTestBase : CommonTestBase
public const string LegacyVersion = "7.13.1"; // For testing deprecated rune and mastery endpoint

public const string StaticChampionKey = "Annie";
public const string StaticChampionName = "Annie";
public const string StaticChampionNameAnnie = "Annie";
public const string StaticChampionNameAatrox = "Aatrox";

public static readonly string StaticTarballLinkBaseUrl = "http://ddragon.leagueoflegends.com/cdn/dragontail-";
public const string StaticTarballLinkVersion = "0.151.2";
Expand Down
4 changes: 2 additions & 2 deletions RiotSharp.Test/EndpointTests/MatchEndpointTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void Initialize()
}

[TestMethod]
public void GetMatchListAsync_Test()
public void GetMatchListAsync_GetTheListOfMatchesOfASpecificSummonerAsync_ReturnMatchList()
{
_rateLimitedRequester.Setup(moq => moq.CreateGetRequestAsync(It.IsAny<string>(), It.IsAny<Region>(),
It.IsAny<List<string>>(), It.IsAny<bool>())).ReturnsAsync(File.ReadAllText(ResponsePath));
Expand All @@ -44,4 +44,4 @@ public void GetMatchListAsync_Test()
}

}
}
}
4 changes: 2 additions & 2 deletions RiotSharp.Test/EndpointTests/SpectatorEndpointTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void Initialize()
}

[TestMethod]
public async Task GetCurrentGameAsync_Test()
public async Task GetCurrentGameAsync_GetsTheCurrentGameBySummonerIDAsync_ReturnCurrentGameOfTheSummoner()
{
_requester.Setup(moq => moq.CreateGetRequestAsync(It.IsAny<string>(), It.IsAny<Region>(),
It.IsAny<List<string>>(), It.IsAny<bool>())).ReturnsAsync(JsonConvert.SerializeObject(_currentGameResponse));
Expand All @@ -73,7 +73,7 @@ public async Task GetCurrentGameAsync_Test()
}

[TestMethod]
public async Task GetFeaturedGamesAsync_Test()
public async Task GetCurrentGameAsync_GetsTheFeaturedGamesByRegionAsync_ReturnFeaturedGamesForTheRegion()
{
_requester.Setup(moq => moq.CreateGetRequestAsync(It.IsAny<string>(), It.IsAny<Region>(),
It.IsAny<List<string>>(), It.IsAny<bool>())).ReturnsAsync(JsonConvert.SerializeObject(_featuredGamesResponse));
Expand Down
2 changes: 1 addition & 1 deletion RiotSharp.Test/EndpointTests/StatusEndpointTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class StatusEndpointTests : CommonTestBase

[TestMethod]
[TestCategory("StatusRiotApi"), TestCategory("Async")]
public void GetShardStatusAsync_Test()
public void GetShardStatusAsync_GetTheLeagueOfLegendsStatusForTheGivenShardAsync_ReturnAShardStatusObject()
{
EnsureCredibility(() =>
{
Expand Down
Loading

0 comments on commit 105acc9

Please sign in to comment.