Example #1
0
        public int Insert(CustomerDto dto)
        {
            var e = string.Format("Insert Called - {0}", GetSummary(dto));

            _eventStream.Add(e);

            return(_customerDataTableGatewayFake.Insert(dto));
        }
            public void GetAllShouldReturnTheExpectedCustomerSet()
            {
                var customerDataTableGatewayFake = new CustomerDataTableGatewayFake();

                customerDataTableGatewayFake.Insert(new CustomerDto()
                {
                    Id        = 100,
                    FirstName = "firstname0",
                    LastName  = "lastname0"
                });

                customerDataTableGatewayFake.Insert(new CustomerDto()
                {
                    Id        = 101,
                    FirstName = "firstname1",
                    LastName  = "lastname1"
                });

                customerDataTableGatewayFake.Insert(new CustomerDto()
                {
                    Id        = 102,
                    FirstName = "firstname2",
                    LastName  = "lastname2"
                });

                var customerRepository = new CustomerRepository(customerDataTableGatewayFake);

                var customers = customerRepository.GetAll();

                Assert.Equal(3, customers.Length);

                Assert.Equal(100, customers[0].GetIdOrZero());
                Assert.Equal("firstname0", customers[0].FirstName);
                Assert.Equal("lastname0", customers[0].LastName);

                Assert.Equal(101, customers[1].GetIdOrZero());
                Assert.Equal("firstname1", customers[1].FirstName);
                Assert.Equal("lastname1", customers[1].LastName);

                Assert.Equal(102, customers[2].GetIdOrZero());
                Assert.Equal("firstname2", customers[2].FirstName);
                Assert.Equal("lastname2", customers[2].LastName);
            }