public void GetSuppliers_SupplierRepositoryIsCalledOnce_WhenCalled() { //ARRANGE var mockSupplierRepository = new Mock <ISupplierRepository>(); mockSupplierRepository.Setup(x => x.GetAll()).Returns(SupplierList()); var mockUoW = new Mock <IMSUnitOfWork>(); mockUoW.Setup(x => x.SupplierRepository).Returns(mockSupplierRepository.Object); var Assistante = new MSAssistantRole(mockUoW.Object); //ACT Assistante.GetSuppliers(); //ASSERT mockSupplierRepository.Verify(x => x.GetAll(), Times.Once); }
public void GetSuppliers_ReturnsSupplierInDB_WhenCalled() { //ARRANGE var mockSupplierRepository = new Mock <ISupplierRepository>(); mockSupplierRepository.Setup(x => x.GetAll()).Returns(SupplierList()); var mockUoW = new Mock <IMSUnitOfWork>(); mockUoW.Setup(x => x.SupplierRepository).Returns(mockSupplierRepository.Object); var Assistante = new MSAssistantRole(mockUoW.Object); //ACT var suppliers = Assistante.GetSuppliers(); //ASSERT Assert.AreEqual(SupplierList().Count(), suppliers.Count()); }