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

            var client = new ApiClient(testServer.CreateClient());
            ApiProductModelResponseModel response = await client.ProductModelGetAsync(1);

            response.Should().NotBeNull();
        }
Exemplo n.º 2
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <IProductModelRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ProductModel>(null));
            var service = new ProductModelService(mock.LoggerMock.Object,
                                                  mock.RepositoryMock.Object,
                                                  mock.ModelValidatorMockFactory.ProductModelModelValidatorMock.Object,
                                                  mock.BOLMapperMockFactory.BOLProductModelMapperMock,
                                                  mock.DALMapperMockFactory.DALProductModelMapperMock,
                                                  mock.BOLMapperMockFactory.BOLProductMapperMock,
                                                  mock.DALMapperMockFactory.DALProductMapperMock,
                                                  mock.BOLMapperMockFactory.BOLProductModelProductDescriptionCultureMapperMock,
                                                  mock.DALMapperMockFactory.DALProductModelProductDescriptionCultureMapperMock);

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

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Exemplo n.º 3
0
        public async void ByName_Exists()
        {
            var mock   = new ServiceMockFacade <IProductModelRepository>();
            var record = new ProductModel();

            mock.RepositoryMock.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult(record));
            var service = new ProductModelService(mock.LoggerMock.Object,
                                                  mock.RepositoryMock.Object,
                                                  mock.ModelValidatorMockFactory.ProductModelModelValidatorMock.Object,
                                                  mock.BOLMapperMockFactory.BOLProductModelMapperMock,
                                                  mock.DALMapperMockFactory.DALProductModelMapperMock,
                                                  mock.BOLMapperMockFactory.BOLProductMapperMock,
                                                  mock.DALMapperMockFactory.DALProductMapperMock,
                                                  mock.BOLMapperMockFactory.BOLProductModelProductDescriptionCultureMapperMock,
                                                  mock.DALMapperMockFactory.DALProductModelProductDescriptionCultureMapperMock);

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

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.ByName(It.IsAny <string>()));
        }
        public async void TestGet()
        {
            ApiProductModelResponseModel response = await this.Client.ProductModelGetAsync(1);

            response.Should().NotBeNull();
        }