Beispiel #1
0
        public async Task AddContactEmailAddress_OK()
        {
            //Arrange
            var mockLogger           = new Mock <ILogger <CustomerService> >();
            var mockCustomerApi      = new Mock <customerApi.ICustomerApiClient>();
            var mockReferenceDataApi = new Mock <referenceDataApi.IReferenceDataApiClient>();
            var mockSalesPersonApi   = new Mock <salesPersonApi.ISalesPersonApiClient>();

            mockCustomerApi
            .Setup(x => x.GetCustomerAsync <customerApi.Models.GetCustomer.StoreCustomer>(It.IsAny <string>()))
            .ReturnsAsync(new StoreCustomerBuilder()
                          .WithTestValues()
                          .Build()
                          );

            var svc = new CustomerService(
                mockLogger.Object,
                Mapper.CreateMapper(),
                mockCustomerApi.Object,
                mockReferenceDataApi.Object,
                mockSalesPersonApi.Object
                );

            //Act
            var viewModel = new EditEmailAddressViewModel
            {
                IsNewEmailAddress = true,
                AccountNumber     = "AW00000001",
                PersonName        = "Orlando N. Gee",
                EmailAddress      = "*****@*****.**"
            };
            await svc.AddContactEmailAddress(viewModel);

            //Assert
            mockCustomerApi.Verify(x => x.UpdateCustomerAsync(
                                       It.IsAny <string>(),
                                       It.IsAny <customerApi.Models.UpdateCustomer.Customer>()
                                       ));
        }