public void ComparePerformsCaseInsensitiveMatchForInfoProperties() { // Arrange var infoLower = new DocumentMetadataInfo { FullName = "fullname", ProjectDisplayName = "projectdisplayname", ProjectFullName = "projectfullname" }; var infoUpper = new DocumentMetadataInfo { FullName = "FULLNAME", ProjectDisplayName = "PROJECTDISPLAYNAME", ProjectFullName = "PROJECTFULLNAME" }; var metadata = new DocumentMetadata(infoLower, null, null); var service = new DocumentMetadataEqualityService(); // Act var isEqual = service.Compare(infoUpper, metadata); // Assert Assert.IsTrue(isEqual); }
public void CompareIsCaseInsensitive( string str1, string str2, bool shouldBeEqual) { // Arrange var service = new DocumentMetadataEqualityService(); // Act var equal = service.Compare(str1, str2); // Assert Assert.AreEqual(shouldBeEqual, equal); }
public void CompareReturnsTrueIfAllInfoPropertiesMatch() { // Arrange var info = new DocumentMetadataInfo { FullName = "FullName", ProjectDisplayName = "ProjectDisplayName", ProjectFullName = "ProjectFullName" }; var metadata = new DocumentMetadata(info, null, null); var service = new DocumentMetadataEqualityService(); // Act var isEqual = service.Compare(info, metadata); // Assert Assert.IsTrue(isEqual); }
public void CompareReturnsFalseIfAnyInfoPropertyDoesNotMatch( bool useMatchingFullName, bool useMatchingProjectDisplayName, bool useMatchingProjectFullName) { // Arrange const string infoFullName = "FullName"; const string infoProjectDisplayName = "ProjectDisplayName"; const string infoProjectFullName = "ProjectFullName"; const string prefix = "Different"; var fullNamePrefix = useMatchingFullName ? string.Empty : prefix; var projectDisplayNamePrefix = useMatchingProjectDisplayName ? string.Empty : prefix; var projectFullNamePrefix = useMatchingProjectFullName ? string.Empty : prefix; var metadataFullName = fullNamePrefix + infoFullName; var metadataProjectDisplayName = projectDisplayNamePrefix + infoProjectDisplayName; var metadataProjectFullName = projectFullNamePrefix + infoProjectFullName; var info = new DocumentMetadataInfo { FullName = infoFullName, ProjectDisplayName = infoProjectDisplayName, ProjectFullName = infoProjectFullName }; var metadata = new DocumentMetadata(new DocumentMetadataInfo { FullName = metadataFullName, ProjectDisplayName = metadataProjectDisplayName, ProjectFullName = metadataProjectFullName }, null, null); var service = new DocumentMetadataEqualityService(); // Act var isEqual = service.Compare(info, metadata); // Assert Assert.IsFalse(isEqual); }