public void TestThatEntireCauseMatches() { var matchable = new MatchableProjections(); matchable.MayDispatchTo(new MockProjection(), new[] { "some-matching-text" }); matchable.MayDispatchTo(new MockProjection(), new[] { "some-other-matching-text" }); matchable.MayDispatchTo(new MockProjection(), new[] { "yet-another-matching-text" }); Assert.Single(matchable.MatchProjections("some-matching-text")); Assert.Single(matchable.MatchProjections("some-other-matching-text")); Assert.Single(matchable.MatchProjections("yet-another-matching-text")); }
public void TestThatContainsCauseMatches() { var matchable = new MatchableProjections(); matchable.MayDispatchTo(new MockProjection(), new[] { "*-matching-*" }); matchable.MayDispatchTo(new MockProjection(), new[] { "*-other-matching-*" }); matchable.MayDispatchTo(new MockProjection(), new[] { "*-another-matching-*" }); matchable.MayDispatchTo(new MockProjection(), new[] { "*-*" }); matchable.MayDispatchTo(new MockProjection(), new[] { "*text*" }); Assert.Equal(3, matchable.MatchProjections("some-matching-text").Count()); Assert.Equal(4, matchable.MatchProjections("some-other-matching-text").Count()); Assert.Equal(4, matchable.MatchProjections("yet-another-matching-text").Count()); Assert.Single(matchable.MatchProjections("text")); // matched with "text*" }
public void TestThatNothingMatches() { var matchable = new MatchableProjections(); matchable.MayDispatchTo(new MockProjection(), new[] { "other-matching-text" }); matchable.MayDispatchTo(new MockProjection(), new[] { "another-matching-text" }); matchable.MayDispatchTo(new MockProjection(), new[] { "matching-text" }); matchable.MayDispatchTo(new MockProjection(), new[] { "text" }); Assert.Empty(matchable.MatchProjections("some-matching-text")); Assert.Empty(matchable.MatchProjections("some-other-matching-text")); Assert.Empty(matchable.MatchProjections("yet-another-matching-text")); Assert.Empty(matchable.MatchProjections("another")); Assert.Empty(matchable.MatchProjections("other")); Assert.Empty(matchable.MatchProjections("matching")); }
public void TestThatEndsWithCauseMatches() { var matchable = new MatchableProjections(); matchable.MayDispatchTo(new MockProjection(), new[] { "*-matching-text" }); matchable.MayDispatchTo(new MockProjection(), new[] { "*-text" }); matchable.MayDispatchTo(new MockProjection(), new[] { "*-other-matching-text" }); matchable.MayDispatchTo(new MockProjection(), new[] { "*-matching-text" }); matchable.MayDispatchTo(new MockProjection(), new[] { "*-text" }); matchable.MayDispatchTo(new MockProjection(), new[] { "*-another-matching-text" }); matchable.MayDispatchTo(new MockProjection(), new[] { "*-matching-text" }); matchable.MayDispatchTo(new MockProjection(), new[] { "*-text" }); matchable.MayDispatchTo(new MockProjection(), new[] { "*text" }); // note matches whole text "text" Assert.Equal(7, matchable.MatchProjections("some-matching-text").Count()); Assert.Equal(8, matchable.MatchProjections("some-other-matching-text").Count()); Assert.Equal(8, matchable.MatchProjections("yet-another-matching-text").Count()); Assert.Single(matchable.MatchProjections("text")); // matched with "text*" }
public void TestThatBeginsWithCauseMatches() { var matchable = new MatchableProjections(); matchable.MayDispatchTo(new MockProjection(), new[] { "some-matching-*" }); matchable.MayDispatchTo(new MockProjection(), new[] { "some-mat*" }); matchable.MayDispatchTo(new MockProjection(), new[] { "some-other-matching-*" }); matchable.MayDispatchTo(new MockProjection(), new[] { "some-other-*" }); matchable.MayDispatchTo(new MockProjection(), new[] { "some-*" }); matchable.MayDispatchTo(new MockProjection(), new[] { "yet-another-matching-*" }); matchable.MayDispatchTo(new MockProjection(), new[] { "yet-another-*" }); matchable.MayDispatchTo(new MockProjection(), new[] { "yet-*" }); matchable.MayDispatchTo(new MockProjection(), new[] { "yet*" }); // note matches whole text "yet" Assert.Equal(3, matchable.MatchProjections("some-matching-text").Count()); Assert.Equal(3, matchable.MatchProjections("some-other-matching-text").Count()); Assert.Equal(4, matchable.MatchProjections("yet-another-matching-text").Count()); Assert.Single(matchable.MatchProjections("yet")); // matched with "yet*" }