Example #1
0
        public void AddPart_OneByOne_SaveProportions()
        {
            // arrange
            var soil = new Soil();

            // act
            soil.Add <Sand>(2);
            soil.Add <Turf>(4);
            soil.Add <Peat>(2);

            // assert
            Assert.AreEqual(2, soil[SoilParts.Sand]);
            Assert.AreEqual(4, soil[SoilParts.Turf]);
            Assert.AreEqual(2, soil[SoilParts.Peat]);
        }
Example #2
0
        public void AddPart_WithNegativeCount_Throws()
        {
            // arrange
            var soil = new Soil()
            {
                Soil.Part <Sand>(1)
            };

            // act
            soil.Add <Sand>(-1);
        }
Example #3
0
        public void AddPart_AfterEndEditing_ReduceProportions()
        {
            // arrange
            var soil = new Soil()
            {
                Soil.Part <Sand>(1)
            };

            // act
            soil.EndEdit();
            soil.Add <Sand>(1);

            // assert
            Assert.AreEqual(1, soil.PartsOf <Sand>());
        }
Example #4
0
        public void AddPart_AfterBeginEditing_ChangesProportions()
        {
            // arrange
            var soil = new Soil()
            {
                Soil.Part <Sand>(1), Soil.Part <Turf>(3)
            };

            // act
            soil.EndEdit();
            soil.BeginEdit();
            soil.Add <Sand>(2);

            // assert
            Assert.AreEqual(3, soil[SoilParts.Sand]);
            Assert.AreEqual(3, soil[SoilParts.Turf]);
        }
Example #5
0
        public void AddPart_WithZeroCount_ChangesNothing()
        {
            // arrange
            var soil = new Soil()
            {
                Soil.Part <Sand>(1)
            };
            var copy = new Soil()
            {
                Soil.Part <Sand>(1)
            };

            // act
            soil.Add <Turf>(0);

            // assert
            Assert.AreEqual(copy, soil);
        }