public void WithAuthenticationProperties_GivenExpected_ShouldPass() { var actualAuthenticationProperties = new AuthenticationProperties(); ActionResult result = new SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); result.Should().BeSignOutResult().WithAuthenticationProperties(actualAuthenticationProperties); }
public void ContainsScheme_GivenExpected_ShouldPass() { const string testScheme = "testScheme"; var actualSchemes = new List <string> { testScheme }; ActionResult result = new SignOutResult(actualSchemes); result.Should().BeSignOutResult().ContainsScheme(testScheme); }
public void WithAllowRefresh_GivenExpected_ShouldPass() { var actualAllowRefresh = true; var actualAuthenticationProperties = new AuthenticationProperties { AllowRefresh = actualAllowRefresh }; ActionResult result = new SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); result.Should().BeSignOutResult().WithAllowRefresh(actualAllowRefresh); }
public void WithIsPersistent_GivenExpected_ShouldPass() { var actualIsPersistent = true; var actualAuthenticationProperties = new AuthenticationProperties { IsPersistent = actualIsPersistent }; ActionResult result = new SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); result.Should().BeSignOutResult().WithIsPersistent(actualIsPersistent); }
public void WithExpiresUtc_GivenExpected_ShouldPass() { var actualExpiresUtc = TestIssuedUtc; var actualAuthenticationProperties = new AuthenticationProperties { ExpiresUtc = actualExpiresUtc }; ActionResult result = new SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); result.Should().BeSignOutResult().WithExpiresUtc(actualExpiresUtc); }
public void WithRedirectUri_GivenExpected_ShouldPass() { var actualRedirectUri = "redirectUri"; var actualAuthenticationProperties = new AuthenticationProperties { RedirectUri = actualRedirectUri }; ActionResult result = new SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); result.Should().BeSignOutResult().WithRedirectUri(actualRedirectUri); }
public void WithAuthenticationProperties_GivenUnexpected_ShouldFail() { var actualAuthenticationProperties = new AuthenticationProperties(); var expectedAuthenticationProperties = new AuthenticationProperties(); ActionResult result = new SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); var failureMessage = FailureMessageHelper.AuthenticationPropertiesExpectations(result); Action a = () => result.Should().BeSignOutResult().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 SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); result.Should().BeSignOutResult().WithExpiresUtc(expectedExpiresUtc); }
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 SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); result.Should().BeSignOutResult().ContainsItem(testKey, testValue); }
public void ContainsItem_GivenNull_ShouldFail() { const string testKey = "testKey"; const string testValue = "testValue"; ActionResult result = new SignOutResult(TestAuthenticationSchemes); var failureMessage = FailureMessageHelper.ExpectedContextContainValueAtKeyButFoundNull( "SignOutResult.AuthenticationProperties.Items", testValue, testKey); Action a = () => result.Should().BeSignOutResult().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 SignOutResult(actualAuthenticationSchemes); result.Should().BeSignOutResult().WithAuthenticationSchemes(expectedAuthenticationSchemes); }
public void ContainsScheme_GivenUnexpected_ShouldFail() { const string testScheme = "testScheme"; const string expectedScheme = "expectedScheme"; var actualSchemes = new List <string> { testScheme }; ActionResult result = new SignOutResult(actualSchemes); var failureMessage = string.Format(FailureMessages.CommonAuthenticationSchemesContainScheme, expectedScheme); Action a = () => result.Should().BeSignOutResult().ContainsScheme(expectedScheme, 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 SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); var failureMessage = FailureMessageHelper.ExpectedAtKeyValueXButFoundY( "SignOutResult.AuthenticationProperties.Items", testKey, expectedValue, testValue); Action a = () => result.Should().BeSignOutResult().ContainsItem(testKey, expectedValue, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void WithIsPersistent_GivenUnexpected_ShouldFail() { var actualIsPersistent = true; var expectedIsPersistent = false; var actualAuthenticationProperties = new AuthenticationProperties { IsPersistent = actualIsPersistent }; ActionResult result = new SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); var failureMessage = FailureMessageHelper.ExpectedContextToBeXButY( "SignOutResult.AuthenticationProperties.IsPersistent", expectedIsPersistent, actualIsPersistent); Action a = () => result.Should().BeSignOutResult().WithIsPersistent(expectedIsPersistent, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void WithExpiresUtc_GivenNull_For_Expected_ShouldFail() { var actualExpiresUtc = TestIssuedUtc; var expectedExpiresUtc = null as DateTimeOffset?; var actualAuthenticationProperties = new AuthenticationProperties { ExpiresUtc = actualExpiresUtc }; ActionResult result = new SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); var failureMessage = FailureMessageHelper.ExpectedContextToBeXButY( "SignOutResult.AuthenticationProperties.ExpiresUtc", FailureMessageHelper.RoundToSeconds(expectedExpiresUtc), FailureMessageHelper.RoundToSeconds(actualExpiresUtc)); Action a = () => result.Should().BeSignOutResult().WithExpiresUtc(expectedExpiresUtc, 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 SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); var failureMessage = FailureMessageHelper.ExpectedContextToBeXButY( "SignOutResult.AuthenticationProperties.AllowRefresh", expectedAllowRefresh, actualAllowRefresh); Action a = () => result.Should().BeSignOutResult().WithAllowRefresh(expectedAllowRefresh, 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 SignOutResult(actualAuthenticationSchemes); var failureMessage = string.Format(FailureMessages.CommonListsNotIdentical, "SignOutResult.AuthenticationSchemes"); Action a = () => result.Should().BeSignOutResult().WithAuthenticationSchemes(expectedAuthenticationSchemes, 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 SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); var failureMessage = FailureMessageHelper.ExpectedContextToBeXButY( "SignOutResult.AuthenticationProperties.RedirectUri", expectedRedirectUri, actualRedirectUri); Action a = () => result.Should().BeSignOutResult().WithRedirectUri(expectedRedirectUri, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void WithIssuedUtc_GivenUnexpected_ShouldFail() { var actualIssuedUtc = TestIssuedUtc; var expectedIssuedUtc = TestIssuedUtc.Value.AddSeconds(1); var actualAuthenticationProperties = new AuthenticationProperties { IssuedUtc = actualIssuedUtc }; ActionResult result = new SignOutResult(TestAuthenticationSchemes, actualAuthenticationProperties); var failureMessage = FailureMessageHelper.ExpectedContextToBeXButY( "SignOutResult.AuthenticationProperties.IssuedUtc", FailureMessageHelper.RoundToSeconds(expectedIssuedUtc), FailureMessageHelper.RoundToSeconds(actualIssuedUtc)); Action a = () => result.Should().BeSignOutResult().WithIssuedUtc(expectedIssuedUtc, Reason, ReasonArgs); a.Should().Throw <Exception>().WithMessage(failureMessage); }
public void BeSignOutResult_GivenSignOutResult_ShouldPass() { ActionResult result = new SignOutResult(); result.Should().BeSignOutResult(); }