Exemple #1
0
        public void FakeRepositoryAndSampleCreationWorksForTests()
        {
            NetcoinRepoRepresentation representation = NetcoinRepositoryUtility.CreateSampleCustomersAndAccounts(5);
            INetcoinRepository        fakeProvider   = new FakeNetcoinRepository();

            fakeProvider.GetCustomers().AddRange(representation.Customers);
            fakeProvider.GetAccounts().AddRange(representation.Accounts);

            Assert.True(fakeProvider.GetCustomers().Count == 5);
            Assert.True(fakeProvider.GetAccounts().Count == 10);
        }
Exemple #2
0
        public void CustomerSearchByCustomerId()
        {
            NetcoinRepoRepresentation representation = NetcoinRepositoryUtility.CreateSampleCustomersAndAccounts(5);
            INetcoinRepository        fakeProvider   = new FakeNetcoinRepository();

            fakeProvider.GetCustomers().AddRange(representation.Customers);
            CustomerService sut    = new CustomerService(fakeProvider);
            var             result = sut.GetCustomerByCustomerId("1");

            Assert.Equal(1, result.CustomerId);
        }
Exemple #3
0
        public void CetCustomerByCustomerId()
        {
            NetcoinRepoRepresentation representation = NetcoinRepositoryUtility.CreateSampleCustomersAndAccounts(5);
            INetcoinRepository        fakeProvider   = new FakeNetcoinRepository();

            fakeProvider.GetCustomers().AddRange(representation.Customers);
            BankSystem sut = new BankSystem(fakeProvider);

            sut.Initialize();

            var result1 = sut.GetCustomerById("1");

            Assert.Throws <NullReferenceException>(() => sut.GetCustomerById("0"));
            Assert.Equal(1, result1.CustomerId);
        }