public void FailWithArgumentExceptionIfSingleProviderDoesntExistInRepository() { var mockUnitOfWork = new Mock <IUnitOfWork>(); mockUnitOfWork.Setup(un => un.ProviderRepository.GetByID(It.IsAny <int>())); ProviderService providerService = new ProviderService(mockUnitOfWork.Object); Provider returnedProvider = providerService.GetSingleProvider(5); }
public void BeAbleToReturnSingleProvicerFromRepository() { Provider singleProvider = new Provider("UTE", 60, new List <IField>()); var mockUnitOfWork = new Mock <IUnitOfWork>(); mockUnitOfWork.Setup(un => un.ProviderRepository.GetByID(singleProvider.ID)).Returns(singleProvider); ProviderService providerService = new ProviderService(mockUnitOfWork.Object); Provider returnedProvider = providerService.GetSingleProvider(singleProvider.ID); mockUnitOfWork.VerifyAll(); Assert.AreSame(singleProvider, returnedProvider); }