public void DoesNotReturn_ExcludedSalutations()
            {
                var query = new FindDistinctSalutationsQuery
                {
                    Exclude = new[]
                    {
                        "Dr.",
                        "Mr."
                    }
                };
                var entities = new Mock <IQueryEntities>(MockBehavior.Strict);

                entities.Setup(p => p.Query <Person>()).Returns(new[]
                {
                    new Person {
                        Salutation = "Dr."
                    },
                    new Person {
                        Salutation = "Mr."
                    },
                    new Person {
                        Salutation = "H.R.H."
                    },
                }.AsQueryable);
                var handler = new FindDistinctSalutationsHandler(entities.Object);

                var results = handler.Handle(query);

                results.ShouldNotBeNull();
                results.Length.ShouldEqual(1);
                results.Count(s => s == "Dr.").ShouldEqual(0);
                results.Count(s => s == "Mr.").ShouldEqual(0);
                results.Count(s => s == "H.R.H.").ShouldEqual(1);
            }
            public void ThrowsArgumentNullException_WhenQueryArgIsNull()
            {
                var handler = new FindDistinctSalutationsHandler(null);
                ArgumentNullException exception = null;

                try
                {
                    handler.Handle(null);
                }
                catch (ArgumentNullException ex)
                {
                    exception = ex;
                }

                exception.ShouldNotBeNull();
                // ReSharper disable PossibleNullReferenceException
                exception.ParamName.ShouldEqual("query");
                // ReSharper restore PossibleNullReferenceException
            }
            public void DoesNotReturn_WhiteSpaceSalutations()
            {
                var query    = new FindDistinctSalutationsQuery();
                var entities = new Mock <IQueryEntities>(MockBehavior.Strict);

                entities.Setup(p => p.Query <Person>()).Returns(new[]
                {
                    new Person {
                        Salutation = "\r "
                    },
                    new Person {
                        Salutation = "H.R.H."
                    },
                }.AsQueryable);
                var handler = new FindDistinctSalutationsHandler(entities.Object);

                var results = handler.Handle(query);

                results.ShouldNotBeNull();
                results.Length.ShouldEqual(1);
                results.Any(s => s == "\r ").ShouldBeFalse();
            }