Пример #1
0
        public void TestRevert()
        {
            //Arrange
            TankHistory history = new TankHistory();
            FuelTank    tank    = new FuelTank()
            {
                FuelLevel = 100, FuelType = "Unleaded"
            };

            //act
            history.memento = tank.CreateMemento();
            tank.FuelLevel  = 150;
            tank.FuelType   = "Diesel";
            tank.RevertTank(history.memento);

            //assert
            Assert.AreEqual(100, tank.FuelLevel);
            Assert.AreEqual("Unleaded", tank.FuelType);
        }