Esempio n. 1
0
        public void ScrewUp()
        {
            // Arrange
            var        greenColor = new PigmentColor(0, 50, 0);
            Paint      green      = new Paint(100.0, greenColor);
            var        blueColor  = new PigmentColor(0, 0, 50);
            Paint      blue       = new Paint(100.0, blueColor);
            MixedPaint paint      = new MixedPaint();

            // Act
            paint.MixIn(green);
            paint.MixIn(blue);

            paint.Constituents.Clear(); // OOPS, somebody has just ruined our business

            Assert.AreEqual(0, paint.Constituents.Count);
        }
Esempio n. 2
0
        public void TestMethod1()
        {
            // Arrange
            var        greenColor = new PigmentColor(0, 50, 0);
            Paint      green      = new Paint(100.0, greenColor);
            var        blueColor  = new PigmentColor(0, 0, 50);
            Paint      blue       = new Paint(100.0, blueColor);
            MixedPaint paint      = new MixedPaint();

            // Act
            paint.MixIn(green);
            paint.MixIn(blue);

            // Assert
            Assert.AreEqual(200.0, paint.Volume, 0.01);
            Assert.AreEqual(0, paint.Color.Red);

            Assert.AreEqual(25, paint.Color.Green);
            Assert.AreEqual(25, paint.Color.Blue);

            Assert.IsTrue(paint.Constituents.Contains(green));
            Assert.IsTrue(paint.Constituents.Contains(blue));
        }
Esempio n. 3
0
 public Paint(double volume, PigmentColor color)
 {
     this.Volume = volume;
     this.Color  = color;
 }