コード例 #1
0
        public void TestGetSubmissionFromSession()
        {
            var userSessionVm = new UserSessionVM {
                HasUserComeFromCheck = true, SubmissionVm = GetTestSubmissionVm()
            };
            var mockRepo       = new Mock <IGenericRepository <Submission> >();
            var mockSchemaRepo = new Mock <IGenericRepository <Schema> >();
            var mockSession    = new Mock <ISessionService>();

            mockSession.Setup(x => x.GetUserSessionVars()).Returns(userSessionVm).Verifiable();
            var sut = new SubmissionService(mockRepo.Object, mockSchemaRepo.Object, mockSession.Object);
            //act
            var result = sut.GetSubmissionFromSession();

            //assert
            result.Should().NotBeNull();
            mockRepo.Verify();
        }