public async Task Get_ProductsWithoutResult_Ok() { var productsDto = UtilityTest.GenerateProductDtoInDifferenttegoryAsync(); var _mediatorMock = new Mock <IMediatorService>(); _mediatorMock.Setup(x => x.Send(It.IsAny <GetAllProductQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(productsDto); var _loggerMock = new Mock <ILogger <ProductsController> >(); var _mockMapper = new Mock <IMapper>(); var productsController = new ProductsController(_loggerMock.Object, _mediatorMock.Object, _mockMapper.Object); var actionResult = await productsController.GetProducts(); var viewResult = Assert.IsType <Microsoft.AspNetCore.Mvc.OkObjectResult>(actionResult); Assert.IsAssignableFrom <List <ProductDto> >(viewResult.Value); }
public void GetAllCoefficientPonderationTest() { ICalibrageApp serviceCalibrageApp = UtilityTest.CreateInstanceService <ICalibrageApp>(); var result = serviceCalibrageApp.GetAllCoeffcientPonderations(); Assert.IsTrue(result != null); Assert.AreEqual(result.Count(), 40); }
public void GetNoteMaxPge_DesordreStructureMaconnerieBetonTest() { //Arrang var hidalgoService = UtilityTest.CreateInstanceService <IHidalgoApp>(); //Act var resultOfService = hidalgoService.GetNotesMaxForAllDocumentPge_DesordreStructureMaconnerieBeton(EFamilleDesordre.Desordre_structure_Maçonnerie_Beton, ENatureCalibrage.Maçonnerie); //Assert Assert.AreEqual(resultOfService.Count(), 223); }
/// <summary> /// Méthode de test /// </summary> public void GetAllDocumentPgeForNatureTravauxEnduitTest() { //Arrang var calculService = UtilityTest.CreateInstanceService <ICalculServiceApp>(); var listeDocumentPge = calculService.GetAllDocumentPge(Data.Contract.Enum.ENatureCalibrage.Enduit); Assert.IsTrue(listeDocumentPge != null); Assert.AreEqual(listeDocumentPge.Count(), 109); }
public void GetNoteMaxPge_FissurationEnduitTest() { //Arrang var hidalgoService = UtilityTest.CreateInstanceService <IHidalgoApp>(); //Act var resultOfService = hidalgoService.GetNotesMaxForAllDocumentPge_Fissuration(EFamilleDesordre.Fissurations, ENatureCalibrage.Enduit); //Assert Assert.AreEqual(resultOfService.Count(), 109); }
public void GetAllLignesAsync() { //Arrang var hidalgoService = UtilityTest.CreateInstanceService <IHidalgoApp>(); //Act var resultOfService = hidalgoService.GetAllLignesAsync(); //Assert Assert.AreEqual(resultOfService.Result.Count(), 62); }
public void GetNoteMaxAllDocumentPge() { //Arrang var hidalgoService = UtilityTest.CreateInstanceService <IHidalgoApp>(); //Act //var resultOfService = hidalgoService.GetAllDocumentPge(); //Assert //Assert.AreEqual(resultOfService.Count(), 404); }
public void Setup() { _settings = UtilityTest.GetMongoDbSettings(); _context = new OrderAppContext(_settings); _unitOfWork = new UnitOfWork(_context); _groupRepository = new GroupRepository(_context); _customerRepository = new CustomerRepository(_context); _productRepository = new ProductRepository(_context); _paymentRepository = new PaymentRepository(_context); _orderRepository = new OrderRepository(_context, _unitOfWork); }
public void GetAllDocumentPgeEnduitTest() { //Arrang var hidalgoService = UtilityTest.CreateInstanceService <IHidalgoApp>(); //Act var resultOfService = hidalgoService.GetAllDocumentPgeByNatureTravaux(ENatureCalibrage.Enduit); //Assert Assert.IsTrue(resultOfService != null); Assert.AreEqual(resultOfService.Count(), 37); }
public void GetAllTypeOuvrageTest() { //Arrang var hidalgoService = UtilityTest.CreateInstanceService <IHidalgoApp>(); //Act var resultOfService = hidalgoService.GetAllTypeOuvrages(); //Assert Assert.IsTrue(resultOfService != null); Assert.AreEqual(resultOfService.Count(), 68); }
public void GetNoteMaxForAllDocumentPge_TravauxConnexesTest() { //Arrang var hidalgoService = UtilityTest.CreateInstanceService <IHidalgoApp>(); var listeDocumentPge = hidalgoService.GetAllDocumentPgeByNatureTravaux(Data.Contract.Enum.ENatureCalibrage.Maçonnerie); //Act hidalgoService.CalculNotesParametresCritere4(this.GetOneProgrammationToTest(), listeDocumentPge); //Assert Assert.IsTrue(true); }
public void EtapeCalcul2Test() { //Arrang var hidalgoService = UtilityTest.CreateInstanceService <IHidalgoApp>(); //Act var result = hidalgoService.CalculEtape2(this.GetOneProgrammationToTest()); //Assert //TODO YAR: faut s'assurer que le fichier est générer, a cause de pression du temps, j'ai laissé ce traitement après Assert.IsTrue(result != null); }
public void CalculPessimisteOptimisteTest() { //Arrang var hidalgoService = UtilityTest.CreateInstanceService <IHidalgoApp>(); var listeDocumentPge = hidalgoService.GetAllDocumentPgeByNatureTravaux(Data.Contract.Enum.ENatureCalibrage.Maçonnerie); //Act hidalgoService.CalculPessimisteOptimiste(this.GetOneProgrammationToTest(), listeDocumentPge); //Assert: un fichier est généré Assert.IsTrue(true); }
public void CalculCritereC2Test() { //Arrang var hidalgoService = UtilityTest.CreateInstanceService <IHidalgoApp>(); var listeDocumentPge = hidalgoService.GetAllDocumentPgeByNatureTravaux(Data.Contract.Enum.ENatureCalibrage.Maçonnerie); //Act var resultOfService = hidalgoService.CalculCritereC2(this.GetOneProgrammationToTest(), listeDocumentPge); //Assert Assert.IsTrue(resultOfService != null); }
public void GetNoteMaxForAllDocumentPge_IgameRatpTest() { //Arrang var hidalgoService = UtilityTest.CreateInstanceService <IHidalgoApp>(); var listeDocumentPge = hidalgoService.GetAllDocumentPgeByNatureTravaux(Data.Contract.Enum.ENatureCalibrage.Maçonnerie); //Act var resultOfService = hidalgoService.GetNoteMaxForAllDocumentPge_ImageRatp(ENatureCalibrage.Maçonnerie, listeDocumentPge); //Assert Assert.IsTrue(resultOfService != null); }
public async Task Get_ProductSingleWithoutResult_NotFound() { var productDto = UtilityTest.GenerateProductDtoInDifferenttegoryAsync().First(); var modelView = new ProductModelView { ProductId = productDto.ProductId, CategoryId = productDto.CategoryId, Name = productDto.Name, CategoryName = "CategoryName", Description = "Desc", Note = "Note", Options = new Dictionary <int, string> { { 1, "Bianco" } } }; var _mediatorMock = new Mock <IMediatorService>(); _mediatorMock.Setup(x => x.Send(It.IsAny <GetProductByIdQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync((ProductModelView)null); var _loggerMock = new Mock <ILogger <ProductsController> >(); var _mockMapper = new Mock <IMapper>(); var productsController = new ProductsController(_loggerMock.Object, _mediatorMock.Object, _mockMapper.Object); var actionResult = await productsController.GetProduct(100); var viewResult = Assert.IsType <Microsoft.AspNetCore.Mvc.NotFoundObjectResult>(actionResult); Assert.IsAssignableFrom <string>(viewResult.Value); Assert.Equal("Product id 100 not found", viewResult.Value); }
public async Task Create_WithInvalidRules_NullObject() { var productsMok = (IReadOnlyList <DomainModel.Entities.Products.Product>)(await UtilityTest.GenerateProductInDifferenttegoryAsync()); var productRepositoryMock = new Mock <IRepository <DomainModel.Entities.Products.Product> >(); productRepositoryMock .Setup(x => x.FindAsync(It.IsAny <IQuerySpecification <DomainModel.Entities.Products.Product> >())) .ReturnsAsync(productsMok); var rules = new List <IRuleSpecification <OrderDto> >(); rules.Add(new OrderAcceptOnlyForProductInSameCategorySpecification(productRepositoryMock.Object)); var orderDto = new OrderDto { Code = "12345", ProductItems = new List <OrderItemDto> { new OrderItemDto { Name = "Pantanoni Lana", ProductId = 1, OptionItems = new List <OrderItemOptionDto> { new OrderItemOptionDto { OptionId = 1, Name = "Colore", Value = "Blu" } } }, new OrderItemDto { Name = "Camicia estiva", ProductId = 3, OptionItems = new List <OrderItemOptionDto> { new OrderItemOptionDto { OptionId = 1, Name = "Colore", Value = "Celeste" }, new OrderItemOptionDto { OptionId = 2, Name = "Taglia", Value = "XL" } } } } }; var orderValidator = await DomainModel.Entities.Orders.Order.CreateOrderAsync(orderDto, rules, null, null); Assert.False(orderValidator.IsValid); Assert.Null(orderValidator.ValidatedObject); }