public async Task should_add_new_customer__and_then_access_that_customer_and_it_should_have_the_same_properties_I_added()
            {

                _db = new AutoResolveContext();
                SUT = new CustomerAsyncRepository(_db);

                iAmANewCustomerEveryTime = new Customer
                {
                    FirstName = "IAmTheUnitTests",
                    LastName = "UnitTests",
                    Email = "*****@*****.**",
                    Telephone = "07368 27272",
                    Title = "Mr",
                };
              

                var originalName = iAmANewCustomerEveryTime.FirstName;
                var originalTele = iAmANewCustomerEveryTime.Telephone;
                var orginalEmai = iAmANewCustomerEveryTime.Email;

                var result = await SUT.Add(iAmANewCustomerEveryTime);


                result.FirstName.ShouldEqual(originalName);
                result.Email.ShouldEqual(orginalEmai);
                result.Telephone.ShouldEqual(originalTele);


            }
            public async Task should_add_new_customer__and_return_id()
            {

                _db = new AutoResolveContext();
                SUT = new CustomerAsyncRepository(_db);

                //some context
                iAmANewCustomerEveryTime = new Customer
                {
                    FirstName = "IAmTheUnitTests",
                    LastName = "UnitTests",
                    Email = "*****@*****.**",
                    Telephone = "07368 27272",
                    Title = "Mr",
                };

                var result = await SUT.Add(iAmANewCustomerEveryTime);
                result.ShouldBeType<Customer>();                                 // returns ID
            }
Ejemplo n.º 3
0
        public async Task TestCustomerPut()
        {
            var customerRepo = new CustomerAsyncRepository();
            var customer = await customerRepo.Get(1);

            customer.FirstName = "testy";
            customer.LastName = "westy";
            customer.Insurer = "Test insurer somewhere";
            customer.PolicyNumber = "test policy number";

            var SUT = new CustomersController();
            await SUT.Put(0, new CustomerViewModel());

            return;
        }