Last active
August 29, 2015 14:13
-
-
Save maaretp/ff4638ae7d9f21f19af0 to your computer and use it in GitHub Desktop.
First Unit Test - before
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestClass] | |
public class ClaimEqualityComparerTest : BaseTest | |
{ | |
[TestMethod] | |
public void Equals_ClaimsAreEqual_ReturnsTrue() | |
{ | |
var claim1 = new Claim { Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", Value = "Foo" }; | |
var claim2 = new Claim { Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", Value = "Foo" }; | |
var comparator = new ClaimEqualityComparer(); | |
comparator.Equals(claim1, claim2).Should().BeTrue(); | |
comparator.Equals(claim2, claim1).Should().BeTrue(); | |
} | |
[TestMethod] | |
public void Equals_ClaimsAreEqualButTypeLetterCaseDiffers_ReturnsTrue() | |
{ | |
var claim1 = new Claim { Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/NAME", Value = "Foo" }; | |
var claim2 = new Claim { Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", Value = "Foo" }; | |
var comparator = new ClaimEqualityComparer(); | |
comparator.Equals(claim1, claim2).Should().BeTrue(); | |
comparator.Equals(claim2, claim1).Should().BeTrue(); | |
} | |
[TestMethod] | |
public void Equals_ClaimsAreEqualButValueLetterCaseDiffers_ReturnsFalse() | |
{ | |
var claim1 = new Claim { Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", Value = "FOO" }; | |
var claim2 = new Claim { Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", Value = "foo" }; | |
var comparator = new ClaimEqualityComparer(); | |
comparator.Equals(claim1, claim2).Should().BeFalse(); | |
comparator.Equals(claim2, claim1).Should().BeFalse(); | |
} | |
[TestMethod] | |
public void Equals_EitherClaimTypeIsNull_ReturnsFalse() | |
{ | |
var claim1 = new Claim { Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", Value = "Foo" }; | |
var claim2 = new Claim { Type = null, Value = "Foo" }; | |
var comparator = new ClaimEqualityComparer(); | |
comparator.Equals(claim1, claim2).Should().BeFalse(); | |
comparator.Equals(claim2, claim1).Should().BeFalse(); | |
} | |
[TestMethod] | |
public void Equals_EitherClaimValueIsNull_ReturnsFalse() | |
{ | |
var claim1 = new Claim { Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", Value = "Foo" }; | |
var claim2 = new Claim { Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", Value = null }; | |
var comparator = new ClaimEqualityComparer(); | |
comparator.Equals(claim1, claim2).Should().BeFalse(); | |
comparator.Equals(claim2, claim1).Should().BeFalse(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment