public void a_single_deny_among_many_filters_will_deny_the_entity()
        {
            var theCase = new Case();
            theCase.Title = "The Title";
            theCase.Condition = "Open";
            theCase.Reason = "Fun";

            var filter = new SingleEntityFilter<Case>(theCase);
            filter.WhereEqual(x => x.Condition, "Open");
            filter.WhereNotEqual(x => x.Title, theCase.Title);
            filter.WhereEqual(x => x.Reason, "Fun");

            filter.CanView.ShouldBeFalse();
        }
        public void a_single_deny_among_many_filters_will_deny_the_entity()
        {
            var theCase = new Case();

            theCase.Title     = "The Title";
            theCase.Condition = "Open";
            theCase.Reason    = "Fun";

            var filter = new SingleEntityFilter <Case>(theCase);

            filter.WhereEqual(x => x.Condition, "Open");
            filter.WhereNotEqual(x => x.Title, theCase.Title);
            filter.WhereEqual(x => x.Reason, "Fun");

            filter.CanView.ShouldBeFalse();
        }
        public void where_equal_should_handle_boxed_values()
        {
            var theCase = new Case();
            theCase.IsSecret = true;

            var filter = new SingleEntityFilter<Case>(theCase);
            filter.WhereEqual(x => x.IsSecret, true);

            filter.CanView.ShouldBeTrue();
        }
        public void where_equal_will_allow_viewing_if_the_entitys_property_and_expected_value_is_null()
        {
            var theCase = new Case();
            theCase.Title = null;

            var filter = new SingleEntityFilter<Case>(theCase);
            filter.WhereEqual(x => x.Title, null);

            filter.CanView.ShouldBeTrue();
        }
        public void or_will_not_allow_viewing_if_the_or_clause_is_false()
        {
            var theCase = new Case();
            theCase.Title = "The Title";

            var filter = new SingleEntityFilter<Case>(theCase);
            filter.WhereEqual(x=> x.Title, "The Title");
            filter.CanView.ShouldBeTrue();
            filter.Or(x => x.WhereEqual(y => y.Title, "Not The Title"), x => x.WhereEqual(y => y.Title, "Not The Title"));
            filter.CanView.ShouldBeFalse();
        }
        public void where_equal_should_handle_entities()
        {
            var person = new Person().WithId();
            var theCase = new Case().WithId();
            theCase.Owner = person;

            var filter = new SingleEntityFilter<Case>(theCase);
            filter.WhereEqual(x => x.Owner, person);

            filter.CanView.ShouldBeTrue();
        }
        public void where_equal_should_handle_boxed_values()
        {
            var theCase = new Case();

            theCase.IsSecret = true;

            var filter = new SingleEntityFilter <Case>(theCase);

            filter.WhereEqual(x => x.IsSecret, true);

            filter.CanView.ShouldBeTrue();
        }
        public void where_equal_will_allow_viewing_if_the_entitys_property_and_expected_value_is_null()
        {
            var theCase = new Case();

            theCase.Title = null;

            var filter = new SingleEntityFilter <Case>(theCase);

            filter.WhereEqual(x => x.Title, null);

            filter.CanView.ShouldBeTrue();
        }
        public void where_equal_will_allow_viewing_if_the_entitys_property_is_a_specific_value()
        {
            var theCase = new Case();

            theCase.Title = "The Title";

            var filter = new SingleEntityFilter <Case>(theCase);

            filter.WhereEqual(x => x.Title, theCase.Title);

            filter.CanView.ShouldBeTrue();
        }
        public void or_will_not_allow_viewing_if_the_or_clause_is_false()
        {
            var theCase = new Case();

            theCase.Title = "The Title";

            var filter = new SingleEntityFilter <Case>(theCase);

            filter.WhereEqual(x => x.Title, "The Title");
            filter.CanView.ShouldBeTrue();
            filter.Or(x => x.WhereEqual(y => y.Title, "Not The Title"), x => x.WhereEqual(y => y.Title, "Not The Title"));
            filter.CanView.ShouldBeFalse();
        }
        public void where_equal_should_handle_entities()
        {
            var person  = new Person().WithId();
            var theCase = new Case().WithId();

            theCase.Owner = person;

            var filter = new SingleEntityFilter <Case>(theCase);

            filter.WhereEqual(x => x.Owner, person);

            filter.CanView.ShouldBeTrue();
        }
        public void where_equal_will_deny_viewing_if_the_entitys_property_is_not_a_specific_value()
        {
            var theCase = new Case();
            theCase.Title = "The Title";

            var filter = new SingleEntityFilter<Case>(theCase);
            filter.WhereEqual(x => x.Title, "Not the Title");

            filter.CanView.ShouldBeFalse();
        }