コード例 #1
0
        public void Test_Cheese_CopyTo_Returns_Cloned()
        {
            _cheese.Price          = 10;
            _cheese.BestBeforeDate = DateTime.Parse("2016-03-19");
            _cheese.DaysToSell     = 5;
            _cheese.Name           = "Good Cheese";
            _cheese.Type           = CheeseTypes.Aged;

            var newCheese = _cheese.Clone() as ICheese;

            Assert.IsNotNull(newCheese);

            Assert.AreEqual(_cheese.Price, newCheese.Price);
            Assert.AreEqual(_cheese.BestBeforeDate, newCheese.BestBeforeDate);
            Assert.AreEqual(_cheese.DaysToSell, newCheese.DaysToSell);
            Assert.AreEqual(_cheese.Name, newCheese.Name);
            Assert.AreEqual(_cheese.Type, newCheese.Type);
        }