示例#1
0
        public void PullEverything_PotWithFlower_ReturnsCurrentContent()
        {
            // arrange
            var pot    = new Pot();
            var flower = new Flower(new PlantSource(Plants.Hedera, SeedType.Seedling));
            var soil   = new Soil("");

            new Planting(flower, soil, pot);

            // act
            var result = pot.PullEverything();

            // assert
            Assert.AreEqual(flower, result.Item2);
            Assert.AreEqual(soil, result.Item1.Item);
        }
示例#2
0
        public void GetFlower_AtMomentBetweenTwoPlantings_ReturnsFirstFlower()
        {
            // arrange
            var pot     = new Pot("small pot");
            var flower1 = new Flower(new PlantSource(Plants.Hedera, SeedType.Seedling));
            var flower2 = new Flower(new PlantSource(Plants.Hedera, SeedType.Seedling));

            new Planting(flower1, new Soil(""), pot);
            var time = DateTime.UtcNow;

            // dirty fix
            Thread.Sleep(1000);
            pot.PullEverything();
            Thread.Sleep(1000);
            new Planting(flower2, new Soil(""), pot);

            // act
            var result = pot.GetFlower(time);

            // assert
            Assert.AreEqual(flower1, result);
        }