コード例 #1
0
ファイル: ForestTests.cs プロジェクト: vbre/CS_2015_Winter
        public void FirTreeWasBornInForest()
        {
            //arrange
            Forest testForest = new Forest();

            //act
            testForest.AddTree(new FirTree());

            //assert
            Assert.AreEqual(1, testForest.TreeCount);
        }
コード例 #2
0
ファイル: ForestTests.cs プロジェクト: vbre/CS_2015_Winter
        public void ChangeSeason()
        {
            //arrange
            Forest testForest = new Forest();
            testForest.AddTree(new FirTree());

            //act
            testForest.ChangeSeason();

            //assert
            Assert.AreEqual(Season.Spring , testForest.CurrentSeason);
        }
コード例 #3
0
ファイル: ForestTests.cs プロジェクト: vbre/CS_2015_Winter
        public void FirTreeWasBornInForest()
        {
            //arrange
            IForest testForest = new Forest();

            //act
            testForest.AddTree(new FirTree());

            //assert
            Assert.AreEqual(1, testForest.TreeCount);
            Assert.IsTrue(testForest.Trees.FirstOrDefault() is FirTree);
        }
コード例 #4
0
ファイル: FirTreeTests.cs プロジェクト: vbre/CS_2015_Winter
        public void InWinterGreenAndShapely()
        {
            //arrange
            Forest testForest = new Forest();
            testForest.AddTree(new FirTree());

            //act
            //testForest.ChangeSeason();

            //assert
            Assert.AreEqual(TreeShape.Shapely , testForest.GetTree(TreeType.FirTree).Shape);
            Assert.AreEqual(TreeColor.Green, testForest.GetTree(TreeType.FirTree).Color);
        }
コード例 #5
0
ファイル: FirTreeTests.cs プロジェクト: vbre/CS_2015_Winter
        public void InSummerGreenAndShapely()
        {
            //arrange
            IForest testForest = new Forest();
            testForest.AddTree(new FirTree());

            //act
            NatureEnvironment.ChangeSeason();
            NatureEnvironment.ChangeSeason();

            //assert
            Assert.AreEqual(Season.Summer, NatureEnvironment.CurrentSeason);
            Assert.AreEqual(TreeShape.Shapely, testForest.Trees.LastOrDefault(x => x is FirTree).Shape);
            Assert.AreEqual(TreeColor.Green, testForest.Trees.LastOrDefault(x => x is FirTree).Color);
        }
コード例 #6
0
ファイル: ForestTests.cs プロジェクト: vbre/CS_2015_Winter
        public void ChangeSeasonOneYear()
        {
            //arrange
            Forest testForest = new Forest();
            testForest.AddTree(new FirTree());

            //act
            testForest.ChangeSeason();
            testForest.ChangeSeason();
            testForest.ChangeSeason();
            testForest.ChangeSeason();

            //assert
            Assert.AreEqual(Season.Winter, testForest.CurrentSeason);
            //Assert.AreEqual(TreeShape.Shapely , testForest.GetTree(TreeType.FirTree).Shape);
            //Assert.AreEqual(TreeColor.Green, testForest.GetTree(TreeType.FirTree).Color);
        }
コード例 #7
0
ファイル: ForestTests.cs プロジェクト: vbre/CS_2015_Winter
        public void AllUseCase()
        {
            Forest testForest = new Forest();
            testForest.AddTree(new FirTree());

            Assert.AreEqual(1 , testForest.TreeCount);  // В лесу родилась
            Assert.AreEqual(TreeType.FirTree, testForest.GetTree(TreeType.FirTree).Type);  // ёлочка
            Assert.AreEqual(Season.Winter , testForest.CurrentSeason);  // Зимой
            Assert.AreEqual(TreeShape.Shapely, testForest.GetTree(TreeType.FirTree).Shape);  // стройная
            Assert.AreEqual(TreeColor.Green, testForest.GetTree(TreeType.FirTree).Color);  // зеленая была

            testForest.ChangeSeason();
            testForest.ChangeSeason();

            Assert.AreEqual(testForest.GetTree(TreeType.FirTree).GrowingSpeed * 2, testForest.GetTree(TreeType.FirTree).Height);  // В лесу она росла
            Assert.AreEqual(Season.Summer, testForest.CurrentSeason);  // и летом
            Assert.AreEqual(TreeShape.Shapely, testForest.GetTree(TreeType.FirTree).Shape);  // стройная
            Assert.AreEqual(TreeColor.Green, testForest.GetTree(TreeType.FirTree).Color);  // зеленая была
        }
コード例 #8
0
ファイル: ForestTests.cs プロジェクト: vbre/CS_2015_Winter
        public void AllUseCase()
        {
            IForest testForest = new Forest();
            testForest.AddTree(new FirTree());
            while (NatureEnvironment.CurrentSeason != Season.Winter)
            {
                NatureEnvironment.ChangeSeason();
            }

            Assert.AreEqual(1 , testForest.TreeCount);  // В лесу родилась
            Assert.IsTrue(testForest.Trees.LastOrDefault() is FirTree);  // ёлочка
            Assert.AreEqual(Season.Winter , NatureEnvironment.CurrentSeason);  // Зимой
            Assert.AreEqual(TreeShape.Shapely, testForest.Trees.LastOrDefault(x => x is FirTree).Shape);  // стройная
            Assert.AreEqual(TreeColor.Green, testForest.Trees.LastOrDefault(x => x is FirTree).Color);  // зеленая была

            NatureEnvironment.ChangeSeason();
            NatureEnvironment.ChangeSeason();

            Assert.AreEqual(testForest.Trees.LastOrDefault(x => x is FirTree).GrowthSpeed * 2, testForest.Trees.LastOrDefault(x => x is FirTree).Height);  // В лесу она росла
            Assert.AreEqual(Season.Summer, NatureEnvironment.CurrentSeason);  // и летом
            Assert.AreEqual(TreeShape.Shapely, testForest.Trees.LastOrDefault(x => x is FirTree).Shape);  // стройная
            Assert.AreEqual(TreeColor.Green, testForest.Trees.LastOrDefault(x => x is FirTree).Color);  // зеленая была
        }