예제 #1
0
        public void SetProperties_DifferentValues_IsDifferent()
        {
            // arrange
            var cell = new EnvironmentalCellBuilder()
                       .With(c => c.IsAlive, true)
                       .With(c => c.Diet, DietaryRestriction.Herbivore)
                       .With(c => c.LifeTime, 5)
                       .Create();
            var cellToCopy = new EnvironmentalCellBuilder()
                             .With(c => c.IsAlive, false)
                             .With(c => c.Diet, DietaryRestriction.Carnivore)
                             .With(c => c.LifeTime, 0)
                             .Create();

            // act
            cell.SetProperties(cellToCopy);

            // assert
            Assert.AreEqual(cell.IsAlive, cellToCopy.IsAlive);
            Assert.AreEqual(cell.Diet, cellToCopy.Diet);
            Assert.AreEqual(cell.LifeTime, cellToCopy.LifeTime);
        }
예제 #2
0
        public void SetProperties_SameValues_StaysSame()
        {
            // arrange
            var cell = new EnvironmentalCellBuilder()
                       .With(c => c.IsAlive, true)
                       .With(c => c.Diet, DietaryRestriction.Herbivore)
                       .With(c => c.LifeTime, 5)
                       .Create();
            var cellToCopy = new EnvironmentalCellBuilder()
                             .With(c => c.IsAlive, true)
                             .With(c => c.Diet, DietaryRestriction.Herbivore)
                             .With(c => c.LifeTime, 5)
                             .Create();

            // act
            cell.SetProperties(cellToCopy);

            // assert
            Assert.AreEqual(cell.IsAlive, true);
            Assert.AreEqual(cell.Diet, DietaryRestriction.Herbivore);
            Assert.AreEqual(cell.LifeTime, 5);
        }