public void ConfirmationControllerTests_Index_InValidData() { var collectionManagementServiceMock = new Mock <ICollectionManagementService>(); collectionManagementServiceMock.Setup(x => x.GetCurrentPeriodAsync("ILR1819")) .ReturnsAsync(() => new ReturnPeriodViewModel(1)); var submissionServiceMock = new Mock <IJobService>(); submissionServiceMock.Setup(x => x.GetConfirmation(It.IsAny <long>(), It.IsAny <long>())) .ReturnsAsync(() => null); var controller = new SubmissionConfirmationAuthorisedController( collectionManagementServiceMock.Object, submissionServiceMock.Object, new Mock <ILogger>().Object); var httpContext = new DefaultHttpContext(); var tempData = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>()); controller.TempData = tempData; var result = controller.Index(It.IsAny <long>()).Result; result.Should().BeOfType(typeof(ViewResult)); var modelresult = ((ViewResult)result).Model; modelresult.Should().BeNull(); }
public void ConfirmationControllerTests_Index_ValidData() { var controller = new SubmissionConfirmationAuthorisedController( new Mock <ICollectionManagementService>().Object, new Mock <IJobService>().Object, new Mock <ILogger>().Object); var httpContext = new DefaultHttpContext(); var tempData = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>()); controller.TempData = tempData; var result = controller.Index(It.IsAny <long>()).Result; result.Should().BeOfType(typeof(ViewResult)); var modelresult = ((ViewResult)result).Model; }