public void AddScenario_DoesntDuplicateOnMultipleCalls() { var name = "scen-name"; var handler = new ScenarioHandler(); handler.AddScenario(name, new GameState()); handler.AddScenario(name, new GameState()); Assert.AreEqual(1, handler.GetScenarioNames().Count(a => a == name)); }
public void AddScenario_DoesntDuplicateOnMultipleCalls() { var name = "scen-name"; var handler = new ScenarioHandler(); handler.AddScenario( name, new GameState() ); handler.AddScenario( name, new GameState() ); Assert.AreEqual( 1, handler.GetScenarioNames().Count( a => a == name ) ); }
public void AddScenario_AddsToCollection() { var name = "scen-name"; var handler = new ScenarioHandler(); handler.AddScenario(name, new GameState()); Assert.IsTrue(handler.GetScenarioNames().Any(a => a == name)); }
public void AddScenario_AddsToCollection() { var name = "scen-name"; var handler = new ScenarioHandler(); handler.AddScenario( name, new GameState() ); Assert.IsTrue( handler.GetScenarioNames().Any( a => a == name ) ); }
public void ValidScenario_ReturnsTrueIfInCollection() { var name = "scen-name"; var handler = new ScenarioHandler(); handler.AddScenario(name, new GameState()); var result = handler.ValidScenario(name); Assert.IsTrue(result); }
public void CopyGameState_ReturnsCopyOfInitialGameState() { var name = "scen-name"; var gameState = this.GetGameState(); var handler = new ScenarioHandler(); handler.AddScenario(name, gameState); var result = handler.CopyGameState(name); Assert.AreNotSame(result, gameState, "Should be a copy, not the stored instance"); result.ShouldBeEquivalentTo(gameState); }
public void CopyGameState_ReturnsCopyOfInitialGameState() { var name = "scen-name"; var gameState = this.GetGameState(); var handler = new ScenarioHandler(); handler.AddScenario( name, gameState ); var result = handler.CopyGameState( name ); Assert.AreNotSame( result, gameState, "Should be a copy, not the stored instance" ); result.ShouldBeEquivalentTo( gameState ); }
public void GetScenarioNames_ReturnsAll() { var handler = new ScenarioHandler(); var names = new List <string>() { "s1", "s2", "s3" }; names.ForEach(a => { handler.AddScenario(a, new GameState()); }); var result = handler.GetScenarioNames(); CollectionAssert.AreEquivalent(names, result.ToList()); }
public void GetScenarioNames_ReturnsAll() { var handler = new ScenarioHandler(); var names = new List<string>() { "s1", "s2", "s3" }; names.ForEach( a => { handler.AddScenario( a, new GameState() ); } ); var result = handler.GetScenarioNames(); CollectionAssert.AreEquivalent( names, result.ToList() ); }
public void ValidScenario_ReturnsTrueIfInCollection() { var name = "scen-name"; var handler = new ScenarioHandler(); handler.AddScenario( name, new GameState() ); var result = handler.ValidScenario( name ); Assert.IsTrue( result ); }