public void should_use_the_data_store_when_looking_whether_an_entity_is_contained()
        {
            var entity = new Fish {Description = "slippery fish"};
            this.dataStore.Save(entity);

            this.dataStore.Contains(entity).ShouldBeEqualTo(true);
        }
        public void should_list_data_store_entities()
        {
            var entity = new Fish { Description = "slippery fish" };
            this.dataStore.Save(entity);

            this.dataStore.List<Fish>().Any().ShouldBeEqualTo(true);
        }
        public void should_save_to_the_data_store()
        {
            var entity = new Fish { Description = "slippery fish" };
            this.dataStore.Save(entity);

            this.dataStore.Contains(entity).ShouldBeEqualTo(true);
        }
        public void should_remove_from_the_data_store()
        {
            var entity = new Fish { Description = "slippery fish" };
            this.dataStore.Save(entity);

            this.dataStore.Remove(entity);
            this.dataStore.Contains(entity).ShouldBeEqualTo(false);
        }
        public void should_enumerate_the_data_store()
        {
            var entity = new Fish { Description = "slippery fish" };
            this.dataStore.Save(entity);

            this.dataStore.GetEnumerator().ShouldBeTheSameObjectAs(
                this.dataStore.GetEnumerator());
        }
        public void should_clear_the_data_store()
        {
            var entity = new Fish { Description = "slippery fish" };
            this.dataStore.Save(entity);

            this.dataStore.Clear();

            this.dataStore.Count().ShouldBeEqualTo(0);
        }
        public void should_find_the_entity()
        {
            var datastore = new InMemoryDataStore();

            var fish = new Fish();
            datastore.Save(fish);

            datastore.Contains(fish).ShouldBeEqualTo(true);
        }
        public void should_return_the_lamba_functions_result_when_building_the_specification()
        {
            var fish = new Fish();
            var context = new List<Fish> { fish }.AsQueryable();
            var interceptWith = new Func<IQueryable<Fish>>(() => context);
            Specification.Intercept<FindAll<Fish>>().With(interceptWith);

            var interceptBy = Specification.Interceptors.GetReplacement(new FindAll<Fish>());
            interceptBy.SetContext(context);
            var result = interceptBy.Build() as IQueryable;
            result.Cast<Fish>().Contains(fish).ShouldBeEqualTo(true);
        }
        public void should_find_the_entity_using_a_custom_equality_comparer()
        {
            var datastore = new InMemoryDataStore();

            var fishA = new Fish { Id = 2 };
            datastore.Save(fishA);
            var fishB = new Fish { Id = 55 };
            datastore.Save(fishB);

            var fishToTest = new Fish { Id = 2 };

            datastore.Contains(fishToTest, new FishIdEqualityComparer()).ShouldBeEqualTo(true);
        }