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

            var client = new ApiClient(testServer.CreateClient());
            ApiBillOfMaterialResponseModel response = await client.BillOfMaterialGetAsync(1);

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

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <BillOfMaterial>(null));
            var service = new BillOfMaterialService(mock.LoggerMock.Object,
                                                    mock.RepositoryMock.Object,
                                                    mock.ModelValidatorMockFactory.BillOfMaterialModelValidatorMock.Object,
                                                    mock.BOLMapperMockFactory.BOLBillOfMaterialMapperMock,
                                                    mock.DALMapperMockFactory.DALBillOfMaterialMapperMock);

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

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Exemple #3
0
        public async void ByProductAssemblyIDComponentIDStartDate_Not_Exists()
        {
            var mock = new ServiceMockFacade <IBillOfMaterialRepository>();

            mock.RepositoryMock.Setup(x => x.ByProductAssemblyIDComponentIDStartDate(It.IsAny <int?>(), It.IsAny <int>(), It.IsAny <DateTime>())).Returns(Task.FromResult <BillOfMaterial>(null));
            var service = new BillOfMaterialService(mock.LoggerMock.Object,
                                                    mock.RepositoryMock.Object,
                                                    mock.ModelValidatorMockFactory.BillOfMaterialModelValidatorMock.Object,
                                                    mock.BOLMapperMockFactory.BOLBillOfMaterialMapperMock,
                                                    mock.DALMapperMockFactory.DALBillOfMaterialMapperMock);

            ApiBillOfMaterialResponseModel response = await service.ByProductAssemblyIDComponentIDStartDate(default(int?), default(int), default(DateTime));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.ByProductAssemblyIDComponentIDStartDate(It.IsAny <int?>(), It.IsAny <int>(), It.IsAny <DateTime>()));
        }
        public async void TestGet()
        {
            ApiBillOfMaterialResponseModel response = await this.Client.BillOfMaterialGetAsync(1);

            response.Should().NotBeNull();
        }