示例#1
0
        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();
        }
示例#2
0
        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>()));
        }
示例#3
0
        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>()));
        }
示例#4
0
        public async void TestGet()
        {
            ApiAddressResponseModel response = await this.Client.AddressGetAsync(1);

            response.Should().NotBeNull();
        }