Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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 ) );
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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 ) );
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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 );
        }
Exemplo n.º 8
0
        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());
        }
Exemplo n.º 9
0
        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() );
        }
Exemplo n.º 10
0
        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 );
        }