コード例 #1
0
        public void Should_Accept_FullIntegrationTest()
        {
            IVendor vendor = new VendorXyz();
            var payment = new Payment(vendor);
            var result = payment.Accept("5678");

            Assert.IsTrue(result);
        }
コード例 #2
0
        public void Should_Reject_SingleCreditCard()
        {
            var vendorMock = new Mock<IVendor>();
            vendorMock.Setup(foo => foo.VerifyCreditCard("1234")).Returns(true);

            var payment = new Payment(vendorMock.Object);
            var result = payment.Accept("5678");

            Assert.IsFalse(result);
        }
コード例 #3
0
        public void Should_Accept_AnyCreditCard()
        {
            var vendorMock = new Mock<IVendor>();
            vendorMock.Setup(foo => foo.VerifyCreditCard(It.IsAny<string>())).Returns(true);

            var payment = new Payment(vendorMock.Object);
            var result = payment.Accept("1234234s");

            Assert.IsTrue(result);
        }