コード例 #1
0
        public void ShouldReturnNullIfNicknameIsNull()
        {
            var bank = new Bank(new EmptyNicknameValidator(), new DuplicatedNicknameValidator());
            var customer = bank.AddCustomer(null, new DateTime(1971, 1, 1));

            Assert.That(customer, Is.Null);
        }
コード例 #2
0
        public void ShouldAddCustomerNickname()
        {
            var bank = new Bank(new EmptyNicknameValidator(), new DuplicatedNicknameValidator());
            var customer = bank.AddCustomer("andy", new DateTime(1971, 1, 1));

            Assert.That(customer, Is.Not.Null);
        }
コード例 #3
0
        public void AMessageIsSentToTheCustomerWhoWasAddedToTheBankImplementeWithMock()
        {
            string expectedRecipient = "*****@*****.**";
            string expectedContent = "Dear Andy, welcome to the bank.";

            var mockGateway = new Mock<MessageGateway>();
            mockGateway.Setup(x => x.Send(expectedRecipient, expectedContent));

            var bank = new Bank(new EmptyNicknameValidator(), new DuplicatedNicknameValidator(), mockGateway.Object);
            var customer = bank.AddCustomer("Andy", new DateTime(1981, 1, 1), "*****@*****.**");

            mockGateway.VerifyAll();
        }
コード例 #4
0
        public void TheBonusIsAddedAfterTheTwoYearPeriodPasswedAndWhenCustomersMakeADeposit()
        {
            var bank = new Bank(new EmptyNicknameValidator(), new DuplicatedNicknameValidator(),
                                new MessageGatewayStub());

            var customer = bank.AddCustomer("Hannah", new DateTime(1981, 1, 1), "*****@*****.**");
            customer.Deposit(100);

            SystemTime.Today = () => new DateTime(2020, 1, 1);

            customer.Deposit(100);
            Assert.That(customer.GetBanalce(), Is.EqualTo(200 + 50));

        }
コード例 #5
0
 public void SetUp()
 {
     _messageGatewayStub = new MessageGatewayStub();
     var bank = new Bank(new EmptyNicknameValidator(), new DuplicatedNicknameValidator(), _messageGatewayStub);
     _customer = bank.AddCustomer("Andy", new DateTime(1981, 01, 01), "*****@*****.**");
 }