public void AddedStatCanBeFound() { // Assign var statsCollection = new StatsCollection(new List <IStatsProvider>() { new FakeStatsProvider() }); // Act statsCollection.Prepare(); statsCollection.Add("Default", new Stat(new FakeStatDefinition() { category = "Default", statName = "Agility" })); statsCollection.Add("Default2", new Stat(new FakeStatDefinition() { category = "Default", statName = "Agility" })); // Assert Assert.IsNotNull(statsCollection.Get("Default", "Agility")); Assert.IsNotNull(statsCollection.GetCategory("Default")); Assert.IsNotNull(statsCollection.GetCategory("Default2")); Assert.IsNotNull(statsCollection.Get("Default2", "Agility")); }
public void FindingStatThatDoesntExistShouldReturnNull() { // Assign var statsCollection = new StatsCollection(new List <IStatsProvider>() { new FakeStatsProvider() }); // Act statsCollection.Prepare(); // Assert Assert.IsNull(statsCollection.Get("NonExistent", "Nope")); Assert.IsNull(statsCollection.GetCategory("NonExistent")); }
public void RemoveStat() { // Assign var statsCollection = new StatsCollection(new List <IStatsProvider>() { new FakeStatsProvider() }); // Act statsCollection.Prepare(); bool removed = statsCollection.Remove("Default", "Health"); // Assert Assert.IsNull(statsCollection.Get("Default", "Health")); Assert.IsTrue(removed); }
public void InitializingStatsCollectionShouldUseDataProviderToFill() { // Assign var statsCollection = new StatsCollection(new List <IStatsProvider>() { new FakeStatsProvider() }); // Act statsCollection.Prepare(); // Assert Assert.IsTrue(statsCollection.ContainsCategory("Default")); Assert.IsTrue(statsCollection.ContainsStat("Default", "Health")); Assert.IsNotNull(statsCollection.Get("Default", "Health")); Assert.IsNotNull(statsCollection.GetCategory("Default")); }