Example #1
0
            public void IfTransferFillsOneBucket_ThenOperationReturnsTrue()
            {
                TwoBucketLab twoBucketLab = new TwoBucketLab(new Bucket(5), new Bucket(3), 4);

                twoBucketLab.BucketB.FillBucket();

                Assert.AreEqual(0, twoBucketLab.BucketA.Volume);
                Assert.AreEqual(3, twoBucketLab.BucketB.Volume);

                twoBucketLab.Transfer(twoBucketLab.BucketB, twoBucketLab.BucketA, 3);
                bool operationResult = twoBucketLab.Transfer(twoBucketLab.BucketA, twoBucketLab.BucketB, 3);

                Assert.IsTrue(operationResult);

                Assert.AreEqual(0, twoBucketLab.BucketA.Volume);
                Assert.AreEqual(3, twoBucketLab.BucketB.Volume);
            }
Example #2
0
            public void IfTransferDoesntFillOrEmptyOneBucket_ThenOperationReturnsFalse()
            {
                TwoBucketLab twoBucketLab = new TwoBucketLab(new Bucket(5), new Bucket(3), 4);

                twoBucketLab.BucketB.FillBucket();

                Assert.AreEqual(0, twoBucketLab.BucketA.Volume);
                Assert.AreEqual(3, twoBucketLab.BucketB.Volume);


                bool operationResult = twoBucketLab.Transfer(twoBucketLab.BucketB, twoBucketLab.BucketA, 2);

                Assert.IsFalse(operationResult);

                Assert.AreEqual(0, twoBucketLab.BucketA.Volume);
                Assert.AreEqual(3, twoBucketLab.BucketB.Volume);
            }
Example #3
0
 public void Initialize(TwoBucketLab bucketLabState)
 {
     TwoBucketLab = bucketLabState;
 }