示例#1
0
        public void TestFill3()
        {
            var bottle = new Bottle(12);

            bottle.Fill(7);
            bottle.Fill(7);
            Assert.AreEqual(12, bottle.Content);
        }
示例#2
0
        public void FillFullBottle_ShouldReturnFalse()
        {
            var bottle = new Bottle(5);

            bottle.Fill();
            var filled = bottle.Fill();

            Assert.IsFalse(filled);
        }
示例#3
0
        public void FillEmptyBottle_ShouldReturnTrue()
        {
            var bottle = new Bottle(5);
            var filled = bottle.Fill();

            Assert.IsTrue(filled);
        }
示例#4
0
        public void TransferBetweenBottles_ShouldSetCorrectAmmount()
        {
            var bottle1 = new Bottle(3);
            var bottle2 = new Bottle(5);

            bottle1.Fill();
            bottle1.Transfer(ref bottle2);

            Assert.AreEqual(0, bottle1.Ammount);
            Assert.AreEqual(3, bottle2.Ammount);

            bottle1.Fill();
            bottle1.Transfer(ref bottle2);

            Assert.AreEqual(1, bottle1.Ammount);
            Assert.AreEqual(5, bottle2.Ammount);
        }
示例#5
0
        public void FillEmptyBottle_ShouldSetCorrectAmmount()
        {
            var bottle = new Bottle(5);

            bottle.Fill();

            Assert.AreEqual(5, bottle.Ammount);
        }
示例#6
0
        public void TestEmpty()
        {
            var bottle = new Bottle(12);

            bottle.Fill(7);
            bottle.Empty();
            Assert.AreEqual(0, bottle.Content);
        }
示例#7
0
        public void TestFillToTopFromTapNotEmpty()
        {
            var bottle = new Bottle(12);

            bottle.Fill(3);
            bottle.FillToTopFromTap();
            Assert.AreEqual(12, bottle.Content);
        }
示例#8
0
        public void PourFullBottle_ShouldSetCorrectAmmount()
        {
            var bottle = new Bottle(5);

            bottle.Fill();
            bottle.Pour();

            Assert.AreEqual(0, bottle.Ammount);
        }
示例#9
0
        public void PourFullBottle_ShouldReturnTrue()
        {
            var bottle = new Bottle(5);

            bottle.Fill();
            var poured = bottle.Pour();

            Assert.IsTrue(poured);
        }
示例#10
0
        public void IsBottleFull_ShouldReturnTrue()
        {
            var bottle1 = new Bottle(3);

            bottle1.Fill();
            var full = bottle1.IsFull();

            Assert.IsTrue(full);
        }
示例#11
0
        public void TestBottleFillOther()
        {
            var bottle  = new Bottle(10);
            var bottle2 = new Bottle(5);

            bottle2.FillFromTap();
            bottle.Fill(bottle2.Empty());

            Assert.AreEqual(5, bottle.Content);
            Assert.AreEqual(0, bottle2.Content);
        }
示例#12
0
        public void TransferToFullBottle_ShouldReturnFalse()
        {
            var bottle1 = new Bottle(3);
            var bottle2 = new Bottle(5);

            bottle1.Fill();
            bottle2.Fill();

            var trans = bottle1.Transfer(ref bottle2);

            Assert.IsFalse(trans);
        }
示例#13
0
 private static void DoOperations(int[] operations, Bottle bottle1, Bottle bottle2, List <int> storage)
 {
     bottle1.Empty();
     bottle2.Empty();
     foreach (var operation in operations)
     {
         if (operation == 0)
         {
             bottle1.FillToTopFromTap();
         }
         else if (operation == 1)
         {
             bottle2.FillToTopFromTap();
         }
         else if (operation == 2)
         {
             bottle2.Fill(bottle1.Empty());
         }
         else if (operation == 3)
         {
             bottle1.Fill(bottle2.Empty());
         }
         else if (operation == 4)
         {
             bottle2.FillToTop(bottle1);
         }
         else if (operation == 5)
         {
             bottle1.FillToTop(bottle2);
         }
         else if (operation == 6)
         {
             bottle1.Empty();
         }
         else if (operation == 7)
         {
             bottle2.Empty();
         }
         //if (storage.Count > 300) storage = new List<int>();
         storage.Add(bottle1.Content);
         storage.Add(bottle2.Content);
     }
 }
示例#14
0
 public void Run()
 {
     Bottle.Fill(Water);
 }