public void InitializeTest()
 {
     MockLogicManager         = MockRepository.GenerateMock <ICustomFieldManager>();
     Target                   = new PublicController(MockLogicManager);
     Target.ControllerContext = new ControllerContext(MockHttpContext, new RouteData(), Target);
     MockHttpContext.Expect(m => m.User).Return(User);
 }
Пример #2
0
 public void InitializeTest()
 {
     MockLogicManager         = MockRepository.GenerateMock <ISchoolDistrictManager>();
     Target                   = new StudentController(MockLogicManager);
     Target.ControllerContext = new ControllerContext(MockHttpContext, new RouteData(), Target);
     MockHttpContext.Expect(m => m.User).Return(User);
 }
Пример #3
0
 public void InitializeTest()
 {
     MockLogicManager         = MockRepository.GenerateMock <ICustomFieldManager>();
     Target                   = new DataFileController(MockLogicManager);
     Target.ControllerContext = new ControllerContext(MockHttpContext, new RouteData(), Target);
     MockHttpContext.Expect(m => m.User).Return(User);
     MockHttpContext.Server.Expect(m => m.MapPath("../../App_Data/Uploads/")).Return(UploadTemplateFolderPath);
 }
Пример #4
0
 public void InitializeTest()
 {
     MockAccountManager        = MockRepository.GenerateMock <IAccountManager>();
     MockSecurityConfiguration = MockRepository.GenerateMock <ISecurityConfiguration>();
     Target = new UserController(MockAccountManager, MockSecurityConfiguration);
     Target.ControllerContext = new ControllerContext(MockHttpContext, new RouteData(), Target);
     MockHttpContext.Expect(m => m.User).Return(User);
 }
        public void GivenUser_WhenIViewProfile_ThenViewResultReturned()
        {
            MockHttpContext.Expect(m => m.User).Return(new EducationSecurityPrincipal(new EducationSecurityIdentity(Identity, TestUser)));

            ViewResult actual = Target.UserProfile();

            Assert.IsNotNull(actual);
        }
Пример #6
0
 public void InitializeTest()
 {
     MockProviderLogicManager = MockRepository.GenerateMock <IProviderManager>();
     MockProgramLogicManager  = MockRepository.GenerateMock <IProgramManager>();
     MockServiceTypeManager   = MockRepository.GenerateMock <IServiceTypeManager>();
     Target = new PartnersController(MockProviderLogicManager, MockProgramLogicManager, MockServiceTypeManager);
     Target.ControllerContext = new ControllerContext(MockHttpContext, new RouteData(), Target);
     MockHttpContext.Expect(m => m.User).Return(User);
 }
        public void GivenUserIdentityIsInvalidType_WhenIViewProfile_ThenThrowException()
        {
            string userIdentifier = "thisisanewuser";

            Identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, userIdentifier));
            MockHttpContext.Expect(m => m.User).Return(new ClaimsPrincipal(new ClaimsIdentity[] { Identity }));

            Target.ExpectException <InvalidCastException>(() => Target.UserProfile());
        }
 public void InitializeTest()
 {
     MockLogicManager         = MockRepository.GenerateMock <IServiceAttendanceManager>();
     MockFileProcessor        = MockRepository.GenerateMock <IFileProcessor>();
     Target                   = new ServiceAttendanceController(MockLogicManager, MockFileProcessor);
     Target.ControllerContext = new ControllerContext(MockHttpContext, new RouteData(), Target);
     MockHttpContext.Expect(m => m.User).Return(User);
     MockHttpContext.Server.Expect(m => m.MapPath("../../App_Data/Uploads/")).Return(UploadTemplateFolderPath);
 }
        public void GivenUser_WhenIViewProfile_ThenLogicManagerGeneratesViewModel()
        {
            EducationSecurityPrincipal expectedUser = new EducationSecurityPrincipal(new EducationSecurityIdentity(Identity, TestUser));

            MockHttpContext.Expect(m => m.User).Return(expectedUser);

            ViewResult actual = Target.UserProfile();

            MockAccountManager.AssertWasCalled(m => m.GenerateUserProfileViewModel(expectedUser));
        }
        public void GivenExceptionIsUnreserved_AndCustomErrorsEnabled_WhenOnException_ThenDefaultToGeneralServerError()
        {
            Exception        exception = new Exception();
            ExceptionContext context   = ControllerContextFactory.CreateExceptionContext(MockHttpContext, exception);

            MockHttpContext.Expect(m => m.IsCustomErrorEnabled).Return(true);

            Target.OnException(context);

            MockHttpContext.Response.AssertWasCalled(m => m.StatusCode = 500);
        }
        public void GivenUser_WhenIViewProfile_ThenViewHasViewModel()
        {
            UserModel expected = new UserModel();
            EducationSecurityPrincipal expectedUser = new EducationSecurityPrincipal(new EducationSecurityIdentity(Identity, TestUser));

            MockHttpContext.Expect(m => m.User).Return(expectedUser);
            MockAccountManager.Expect(m => m.GenerateUserProfileViewModel(expectedUser)).Return(expected);

            ViewResult actual = Target.UserProfile();

            actual.AssertGetViewModel(expected);
        }
Пример #12
0
        public void GivenValidModelWithId_WhenLoginAuditDataTableAjaxHandler_TheJSonResultReturned()
        {
            HttpRequestBase MockRequest = MockRepository.GenerateMock <HttpRequestBase>();

            MockRequest.Expect(m => m["id"]).Return("1");
            DataTableRequestModel model = new DataTableRequestModel();

            MockHttpContext.Expect(c => c.Request).Return(MockRequest).Repeat.Any();

            var result = Target.LoginAuditDataTableAjaxHandler(model) as JsonResult;

            Assert.IsNotNull(result);
        }