public void ChallengeResult_ReturnChallengeResult()
        {
            // Arrange
            var authenticationProperties = new AuthenticationProperties(new AttributeDictionary {
                { "TestKey", "TestValue" }
            });

            var challengeResult = new ChallengeResult
            {
                Properties            = authenticationProperties,
                AuthenticationSchemes = new List <string> {
                    "TestProvider"
                }
            };

            // Act & Assert
            var result = Assert.IsType <ChallengeResult>(
                MvcAssert.ChallengeResult(
                    challengeResult,
                    authenticationProperties,
                    "TestProvider"
                    )
                );

            Assert.Equal(challengeResult, result);
        }
        public void ChallengeResult_ThrowsIsTypeException_WhenIActionResultIsNotChallengeResult()
        {
            // Arrange
            var mockActionResult = new Mock <IActionResult>(MockBehavior.Strict);

            // Act & Assert
            Assert.Throws <IsTypeException>(() => MvcAssert.ChallengeResult(mockActionResult.Object, new AuthenticationProperties(), "TestProvider"));
        }
        public void ChallengeResult_ThrowsEqualException_WhenAuthenticationPropertiesNotEqual()
        {
            // Arrange
            var challengeResult = new ChallengeResult(new AuthenticationProperties(new AttributeDictionary {
                { "TestKey", "TestValue" }
            }));

            // Act & Assert
            Assert.Throws <EqualException>(
                () => MvcAssert.ChallengeResult(
                    challengeResult,
                    new AuthenticationProperties(new AttributeDictionary {
                { "TestKey", "OtherTestValue" }
            }),
                    "TestProvider"
                    )
                );
        }
        public void ChallengeResult_ThrowsContainsException_WhenNoSuchProvider()
        {
            // Arrange
            var authenticationProperties = new AuthenticationProperties(new AttributeDictionary {
                { "TestKey", "TestValue" }
            });

            var challengeResult = new ChallengeResult
            {
                Properties            = authenticationProperties,
                AuthenticationSchemes = new List <string> {
                    "TestProvider"
                }
            };

            // Act & Assert
            Assert.Throws <ContainsException>(
                () => MvcAssert.ChallengeResult(
                    challengeResult,
                    authenticationProperties,
                    "OtherTestProvider"
                    )
                );
        }