예제 #1
0
        public void MoneyBagTest()
        {
            Cash    start = new Cash(6, "CHF");
            Cash    add   = new Cash(5, "PLN");
            CashBag test  = new CashBag(start, add);

            Assert.AreEqual(start.AddMoneyBag(test), test.Multiply(2).Subtract(add));
        }
예제 #2
0
        public void TestMock()
        {
            //assert
            var Cash    = new Cash(2, "PLN");
            var mockBag = new Mock <ICash>();

            mockBag.Setup(x => x.AddMoney(It.IsAny <Cash>())).Returns(new Cash(1, "CHF"));
            //act
            Cash.AddMoneyBag(mockBag.Object);
            //assert
            Assert.IsTrue(true);
            mockBag.Verify(mock => mock.AddMoney(It.IsAny <Cash>()), Times.Never());
        }