public void DoesNotReturn_WhiteSpaceSuffixes() { var query = new FindDistinctSuffixesQuery(); var entities = new Mock<IQueryEntities>(MockBehavior.Strict); entities.Setup(p => p.Query<Person>()).Returns(new[] { new Person{ Suffix = "\r " }, new Person{ Suffix = "S1" }, }.AsQueryable); var handler = new FindDistinctSuffixesHandler(entities.Object); var results = handler.Handle(query); results.ShouldNotBeNull(); results.Length.ShouldEqual(1); results.Any(s => s == "\r ").ShouldBeFalse(); }
public void DoesNotReturn_ExcludedSuffixes() { var query = new FindDistinctSuffixesQuery { Exclude = new[] { "S1", "S2" } }; var entities = new Mock<IQueryEntities>(MockBehavior.Strict); entities.Setup(p => p.Query<Person>()).Returns(new[] { new Person{ Suffix = "S1" }, new Person{ Suffix = "S2" }, new Person{ Suffix = "H.R.H." }, }.AsQueryable); var handler = new FindDistinctSuffixesHandler(entities.Object); var results = handler.Handle(query); results.ShouldNotBeNull(); results.Length.ShouldEqual(1); results.Count(s => s == "S1").ShouldEqual(0); results.Count(s => s == "S2").ShouldEqual(0); results.Count(s => s == "H.R.H.").ShouldEqual(1); }