Beispiel #1
0
        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 AssistantRole(mockUoW.Object);

            //ACT
            Assistante.GetSuppliers();

            //ASSERT
            mockSupplierRepository.Verify(x => x.GetAll(), Times.Once);
        }
Beispiel #2
0
        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 AssistantRole(mockUoW.Object);

            //ACT
            var suppliers = Assistante.GetSuppliers();

            //ASSERT
            Assert.AreEqual(SupplierList().Count(), suppliers.Count());
        }