public async void TestGet()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());
            ApiAddressTypeResponseModel response = await client.AddressTypeGetAsync(1);

            response.Should().NotBeNull();
        }
예제 #2
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <IAddressTypeRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <AddressType>(null));
            var service = new AddressTypeService(mock.LoggerMock.Object,
                                                 mock.RepositoryMock.Object,
                                                 mock.ModelValidatorMockFactory.AddressTypeModelValidatorMock.Object,
                                                 mock.BOLMapperMockFactory.BOLAddressTypeMapperMock,
                                                 mock.DALMapperMockFactory.DALAddressTypeMapperMock,
                                                 mock.BOLMapperMockFactory.BOLBusinessEntityAddressMapperMock,
                                                 mock.DALMapperMockFactory.DALBusinessEntityAddressMapperMock);

            ApiAddressTypeResponseModel response = await service.Get(default(int));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
예제 #3
0
        public async void ByName_Exists()
        {
            var mock   = new ServiceMockFacade <IAddressTypeRepository>();
            var record = new AddressType();

            mock.RepositoryMock.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult(record));
            var service = new AddressTypeService(mock.LoggerMock.Object,
                                                 mock.RepositoryMock.Object,
                                                 mock.ModelValidatorMockFactory.AddressTypeModelValidatorMock.Object,
                                                 mock.BOLMapperMockFactory.BOLAddressTypeMapperMock,
                                                 mock.DALMapperMockFactory.DALAddressTypeMapperMock,
                                                 mock.BOLMapperMockFactory.BOLBusinessEntityAddressMapperMock,
                                                 mock.DALMapperMockFactory.DALBusinessEntityAddressMapperMock);

            ApiAddressTypeResponseModel response = await service.ByName(default(string));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.ByName(It.IsAny <string>()));
        }
예제 #4
0
        public async void TestGet()
        {
            ApiAddressTypeResponseModel response = await this.Client.AddressTypeGetAsync(1);

            response.Should().NotBeNull();
        }