Esempio n. 1
0
        protected override void Setup()
        {
            base.Setup();

            /*
             * Stub the interface dependencies, don't need to use the actual objects, but force of habit
             */
            StubCustomerService.Stub(s => s.GetByIdAsync(-99)).Return(Task.FromResult(new Customer {
            }));
            StubCustomerService.Stub(s => s.DeleteAsync(ActualCustomers.FirstOrDefault())).Return(Task.FromResult(ActualCustomers.FirstOrDefault()));

            ConfigureApi(HttpMethod.Delete, "http://localhost/api/customers/-99");
        }
Esempio n. 2
0
        protected override void Setup()
        {
            base.Setup();

            /*
             * Stub the interface dependencies, don't need to use the actual objects, but force of habit
             */
            StubCustomerService.Stub(s => s.GetByIdAsync(1)).Return(Task.FromResult(ActualCustomers.FirstOrDefault()));
            StubAutoMapper.Stub(m => m.Map <Customer, CustomerDto>(ActualCustomers.FirstOrDefault())).Return(ExpectedCustomerDto);

            ConfigureApi(HttpMethod.Get, "http://localhost/api/customers/1");

            ExpectedJson = JsonConvert.SerializeObject(ExpectedCustomerDto);
        }
Esempio n. 3
0
 public void GetByIdAsync_ItShouldCallTheAutoMapperEngine()
 {
     ArrangeAndAct();
     StubAutoMapper.AssertWasCalled(m => m.Map <Customer, CustomerDto>(ActualCustomers.FirstOrDefault()));
 }