Пример #1
0
        static void Main(string[] args)
        {
            Flask flask = new Flask(4);

            DisplayFlask(flask);

            Console.WriteLine("Calls flask.Fill( 3 )");
            flask.Fill(3);
            DisplayFlask(flask);

            Console.WriteLine("Calls flask.Fill( 2 )");
            flask.Fill(2);
            DisplayFlask(flask);

            Console.WriteLine("Calls flask.Empty( 1 )");
            flask.Empty(1);
            DisplayFlask(flask);

            Console.WriteLine("Calls flask.Empty()");
            flask.Empty();
            DisplayFlask(flask);

            Console.WriteLine("Calls flask.Fill()");
            flask.Fill();

            DisplayFlask(flask);

            new Flask(2);
            new Flask(3);
            Console.WriteLine("Flasks created: {0}", Flask.TotalCount);

            new Flask(1);
            new Flask(4);
            Console.WriteLine("Flasks created: {0}", Flask.TotalCount);
        }
Пример #2
0
        public void fill_a_flask(int volume, int expected)
        {
            Flask sut = new Flask(2);

            sut.Fill(volume);
            Assert.AreEqual(expected, sut.Volume);
        }
Пример #3
0
        public void total_empty()
        {
            Flask sut = new Flask(3);

            sut.Fill(2);

            sut.Empty();

            Assert.That(sut.Volume, Is.EqualTo(0));
        }
Пример #4
0
        public void empty_flask()
        {
            Flask sut = new Flask(3);

            sut.Fill(2);

            sut.Empty(1);

            Assert.That(sut.Volume, Is.EqualTo(1));
        }
Пример #5
0
        public void fill_with_negative_volume_should_throws_an_exception()
        {
            Flask sut = new Flask(3);

            Assert.Throws <ArgumentException>(() => sut.Fill(-1));
        }