public async void TestGet() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiAddressResponseModel response = await client.AddressGetAsync(1); response.Should().NotBeNull(); }
public async void Get_null_record() { var mock = new ServiceMockFacade <IAddressRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Address>(null)); var service = new AddressService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.AddressModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLAddressMapperMock, mock.DALMapperMockFactory.DALAddressMapperMock, mock.BOLMapperMockFactory.BOLBusinessEntityAddressMapperMock, mock.DALMapperMockFactory.DALBusinessEntityAddressMapperMock); ApiAddressResponseModel response = await service.Get(default(int)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public async void ByAddressLine1AddressLine2CityStateProvinceIDPostalCode_Not_Exists() { var mock = new ServiceMockFacade <IAddressRepository>(); mock.RepositoryMock.Setup(x => x.ByAddressLine1AddressLine2CityStateProvinceIDPostalCode(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>())).Returns(Task.FromResult <Address>(null)); var service = new AddressService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.AddressModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLAddressMapperMock, mock.DALMapperMockFactory.DALAddressMapperMock, mock.BOLMapperMockFactory.BOLBusinessEntityAddressMapperMock, mock.DALMapperMockFactory.DALBusinessEntityAddressMapperMock); ApiAddressResponseModel response = await service.ByAddressLine1AddressLine2CityStateProvinceIDPostalCode(default(string), default(string), default(string), default(int), default(string)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.ByAddressLine1AddressLine2CityStateProvinceIDPostalCode(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>())); }
public async void TestGet() { ApiAddressResponseModel response = await this.Client.AddressGetAsync(1); response.Should().NotBeNull(); }