public void ShouldMatchExact() { var expectedMatches = TestTypes.Select(x => (SourceType: x, DestinationType: x)).ToArray(); var matcher = DefaultMappingMatchers.TypeNameMatcher("{name}", "{name}", MappingMatcherBehaviors.MatchIdenticalType); var actualMatches = TestTypePairs.Where(x => matcher(x.SourceType, x.DestinationType)).ToArray(); CollectionAssert.AreEquivalent(expectedMatches, actualMatches); }
public void ShouldThrowArgumentExceptionOnInvalidMatcher() { var testValues = new[] { null, String.Empty, "{}", "{tokenA}{tokenB}", "{tokenA{tokenB}}Any", "Any{unclosedToken" }; foreach (var testValue in testValues) { Assert.ThrowsException <ArgumentException>(() => DefaultMappingMatchers.TypeNameMatcher(testValue, "x")); Assert.ThrowsException <ArgumentException>(() => DefaultMappingMatchers.TypeNameMatcher("x", testValue)); } }