예제 #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 MSAssistantRole(mockUoW.Object);

            //ACT
            Assistante.GetSuppliers();

            //ASSERT
            mockSupplierRepository.Verify(x => x.GetAll(), Times.Once);
        }
예제 #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 MSAssistantRole(mockUoW.Object);

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

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