LoginGet() private method

private LoginGet ( string id, string returnUrl ) : System.Web.Mvc.ActionResult
id string
returnUrl string
return System.Web.Mvc.ActionResult
コード例 #1
0
        public void LoginGet_Does_Not_Alter_ViewName_If_It_Starts_With_Tilde()
        {
            // Arrange
            var controller = new IdentityController();
            controller.IdentitySources.AddMock(UnusedMockIdentitySource);

            var mockSource = controller.IdentitySources.AddMock(SelectedMockIdentitySource);

            mockSource.Setup(s => s.Login(It.IsAny<ControllerContext>(), TestReturnUrl))
                      .Returns(new ViewResult { ViewName = TestExplicitViewName });

            // Act
            ActionResult actualResult = controller.LoginGet(SelectedMockIdentitySource, TestReturnUrl.ToString());

            // Assert
            ResultAssert.IsView(actualResult, TestExplicitViewName, ExpectedMasterName);
        }
コード例 #2
0
        public void LoginGet_Returns_Result_Of_IdentitySource_Login()
        {
            // Arrange
            var controller = new IdentityController();
            controller.IdentitySources.AddMock(UnusedMockIdentitySource);

            var mockSource = controller.IdentitySources.AddMock(SelectedMockIdentitySource);

            EmptyResult expectedResult = new EmptyResult();
            mockSource.Setup(s => s.Login(It.IsAny<ControllerContext>(), TestReturnUrl))
                      .Returns(expectedResult);

            // Act
            ActionResult actualResult = controller.LoginGet(SelectedMockIdentitySource, TestReturnUrl.ToString());

            // Assert
            Assert.AreSame(expectedResult, actualResult, "Expected that the result of Login would be passed unmodified");
        }
コード例 #3
0
        public void LoginGet_Calls_Login_With_ControllerContext_And_ReturnUrl_If_IdentitySource_Found()
        {
            // Arrange
            var controller = new IdentityController();
            controller.IdentitySources.AddMock(UnusedMockIdentitySource);

            var mockSource = controller.IdentitySources.AddMock(SelectedMockIdentitySource);

            // Act
            controller.LoginGet(SelectedMockIdentitySource, TestReturnUrl.ToString());

            // Assert
            mockSource.Verify(s => s.Login(controller.ControllerContext, TestReturnUrl));
        }