public void WithAuthenticationProperties_GivenExpected_ShouldPass() { var actualAuthenticationProperties = new AuthenticationProperties(); ActionResult result = new ChallengeResult(actualAuthenticationProperties); result.Should().BeChallengeResult().WithAuthenticationProperties(actualAuthenticationProperties); }
public void WithRedirectUri_GivenExpected_ShouldPass() { var actualRedirectUri = "redirectUri"; var actualAuthenticationProperties = new AuthenticationProperties { RedirectUri = actualRedirectUri }; ActionResult result = new ChallengeResult(actualAuthenticationProperties); result.Should().BeChallengeResult().WithRedirectUri(actualRedirectUri); }
public void WithIssuedUtc_GivenExpected_ShouldPass() { var actualIssuedUtc = TestLastModified; var actualAuthenticationProperties = new AuthenticationProperties { IssuedUtc = actualIssuedUtc }; ActionResult result = new ChallengeResult(actualAuthenticationProperties); result.Should().BeChallengeResult().WithIssuedUtc(actualIssuedUtc); }
public void WithAllowRefresh_GivenExpected_ShouldPass() { var actualAllowRefresh = true; var actualAuthenticationProperties = new AuthenticationProperties { AllowRefresh = actualAllowRefresh }; ActionResult result = new ChallengeResult(actualAuthenticationProperties); result.Should().BeChallengeResult().WithAllowRefresh(actualAllowRefresh); }
public void WithIsPersistent_GivenExpected_ShouldPass() { var actualIsPersistent = true; var actualAuthenticationProperties = new AuthenticationProperties { IsPersistent = actualIsPersistent }; ActionResult result = new ChallengeResult(actualAuthenticationProperties); result.Should().BeChallengeResult().WithIsPersistent(actualIsPersistent); }
public void ContainsScheme_GivenExpected_ShouldPass() { const string testScheme = "testScheme"; var actualSchemes = new List <string> { testScheme }; ActionResult result = new ChallengeResult(actualSchemes); result.Should().BeChallengeResult().ContainsScheme(testScheme); }
public void WithAuthenticationProperties_GivenUnexpected_ShouldFail() { var actualAuthenticationProperties = new AuthenticationProperties(); var expectedAuthenticationProperties = new AuthenticationProperties(); ActionResult result = new ChallengeResult(actualAuthenticationProperties); var failureMessage = FailureMessageHelper.AuthenticationPropertiesExpectations(result); Action a = () => result.Should().BeChallengeResult().WithAuthenticationProperties(expectedAuthenticationProperties, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void WithExpiresUtc_GivenNull_ShouldPass() { var actualExpiresUtc = null as DateTimeOffset?; var expectedExpiresUtc = null as DateTimeOffset?; var actualAuthenticationProperties = new AuthenticationProperties { ExpiresUtc = actualExpiresUtc }; ActionResult result = new ChallengeResult(actualAuthenticationProperties); result.Should().BeChallengeResult().WithExpiresUtc(expectedExpiresUtc); }
public void ContainsItem_GivenNull_ShouldFail() { const string testKey = "testKey"; const string testValue = "testValue"; ActionResult result = new ChallengeResult(); var failureMessage = FailureMessageHelper.ExpectedContextContainValueAtKeyButFoundNull( "ChallengeResult.AuthenticationProperties.Items", testValue, testKey); Action a = () => result.Should().BeChallengeResult().ContainsItem(testKey, testValue, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void WithAuthenticationSchemes_GivenExpected_ShouldPass() { var actualAuthenticationSchemes = new List <string> { "one", "two" }; var expectedAuthenticationSchemes = new List <string> { "two", "one" }; ActionResult result = new ChallengeResult(actualAuthenticationSchemes); result.Should().BeChallengeResult().WithAuthenticationSchemes(expectedAuthenticationSchemes); }
public void ContainsItem_GivenExpected_ShouldPass() { const string testKey = "testKey"; const string testValue = "testValue"; var properties = new Dictionary <string, string> { { testKey, testValue } }; var actualAuthenticationProperties = new AuthenticationProperties(properties); ActionResult result = new ChallengeResult(actualAuthenticationProperties); result.Should().BeChallengeResult().ContainsItem(testKey, testValue, Reason, ReasonArgs); }
public void WithIsPersistent_GivenUnexpected_ShouldFail() { var actualIsPersistent = true; var expectedIsPersistent = false; var actualAuthenticationProperties = new AuthenticationProperties { IsPersistent = actualIsPersistent }; ActionResult result = new ChallengeResult(actualAuthenticationProperties); var failureMessage = FailureMessageHelper.ExpectedContextToBeXButY("ChallengeResult.AuthenticationProperties.IsPersistent", expectedIsPersistent, actualIsPersistent); Action a = () => result.Should().BeChallengeResult().WithIsPersistent(expectedIsPersistent, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void ContainsScheme_GivenUnexpected_ShouldFail() { const string testScheme = "testScheme"; const string expectedScheme = "expectedScheme"; var actualSchemes = new List <string> { testScheme }; ActionResult result = new ChallengeResult(actualSchemes); var failureMessage = string.Format(FailureMessages.CommonAuthenticationSchemesContainScheme, expectedScheme); Action a = () => result.Should().BeChallengeResult().ContainsScheme(expectedScheme, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void WithRedirectUri_GivenUnexpected_ShouldFail() { var actualRedirectUri = "redirectUri"; var expectedRedirectUri = "otherUri"; var actualAuthenticationProperties = new AuthenticationProperties { RedirectUri = actualRedirectUri }; ActionResult result = new ChallengeResult(actualAuthenticationProperties); var failureMessage = FailureMessageHelper.ExpectedContextToBeXButY("ChallengeResult.AuthenticationProperties.RedirectUri", expectedRedirectUri, actualRedirectUri); Action a = () => result.Should().BeChallengeResult().WithRedirectUri(expectedRedirectUri, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void WithAllowRefresh_GivenUnexpected_ShouldFail() { var actualAllowRefresh = true; var expectedAllowRefresh = false; var actualAuthenticationProperties = new AuthenticationProperties { AllowRefresh = actualAllowRefresh }; ActionResult result = new ChallengeResult(actualAuthenticationProperties); var failureMessage = FailureMessageHelper.ExpectedContextToBeXButY("ChallengeResult.AuthenticationProperties.AllowRefresh", expectedAllowRefresh, actualAllowRefresh); Action a = () => result.Should().BeChallengeResult().WithAllowRefresh(expectedAllowRefresh, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void WithExpiresUtc_GivenNull_For_Expected_ShouldFail() { var actualExpiresUtc = TestLastModified; var expectedExpiresUtc = null as DateTimeOffset?; var actualAuthenticationProperties = new AuthenticationProperties { ExpiresUtc = actualExpiresUtc }; ActionResult result = new ChallengeResult(actualAuthenticationProperties); var convertedActualExpiresUtc = FailureMessageHelper.RoundToSeconds(actualExpiresUtc); var failureMessage = FailureMessageHelper.ExpectedContextToBeXButY("ChallengeResult.AuthenticationProperties.ExpiresUtc", null, convertedActualExpiresUtc); Action a = () => result.Should().BeChallengeResult().WithExpiresUtc(expectedExpiresUtc, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void WithAuthenticationSchemes_GivenUnexpected_ShouldFail() { var actualAuthenticationSchemes = new List <string>() { "one", "two", "three" }; var expectedAuthenticationSchemes = new List <string> { "three", "four", "five" }; ActionResult result = new ChallengeResult(actualAuthenticationSchemes); var failureMessage = string.Format(FailureMessages.CommonListsNotIdentical, "ChallengeResult.AuthenticationSchemes"); Action a = () => result.Should().BeChallengeResult().WithAuthenticationSchemes(expectedAuthenticationSchemes, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void WithIssuedUtc_GivenUnexpected_ShouldFail() { var actualIssuedUtc = TestLastModified; var expectedIssuedUtc = TestLastModified.Value.AddSeconds(1); var actualAuthenticationProperties = new AuthenticationProperties { IssuedUtc = actualIssuedUtc }; ActionResult result = new ChallengeResult(actualAuthenticationProperties); var convertedExpectedIssuedUtc = FailureMessageHelper.RoundToSeconds(expectedIssuedUtc); var convertedActualIssuedUtc = FailureMessageHelper.RoundToSeconds(actualIssuedUtc); var failureMessage = FailureMessageHelper.ExpectedContextToBeXButY("ChallengeResult.AuthenticationProperties.IssuedUtc", convertedExpectedIssuedUtc, convertedActualIssuedUtc); Action a = () => result.Should().BeChallengeResult().WithIssuedUtc(expectedIssuedUtc, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void ContainsItem_GivenUnexpectedValue_ShouldFail() { const string testKey = "testKey"; const string testValue = "testValue"; const string expectedValue = "wrong value"; var properties = new Dictionary <string, string> { { testKey, testValue } }; var actualAuthenticationProperties = new AuthenticationProperties(properties); ActionResult result = new ChallengeResult(actualAuthenticationProperties); var failureMessage = FailureMessageHelper.ExpectedAtKeyValueXButFoundY( "ChallengeResult.AuthenticationProperties.Items", testKey, expectedValue, testValue); Action a = () => result.Should().BeChallengeResult().ContainsItem(testKey, expectedValue, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void BeChallengeResult_GivenChallengeResult_ShouldPass() { ActionResult result = new ChallengeResult(); result.Should().BeChallengeResult(); }