public void Can_find_entities_by_using_predicate()
        {
            var entity     = Substitute.For <IAggregate>();
            var repository = new InMemoryTestRepository();

            repository.CurrentState.Add(entity);

            var foundEntity = repository.Find(e => e.Id == entity.Id).ToList();

            Assert.AreEqual(foundEntity[0], entity);
        }
        public void Can_find_entity_by_id()
        {
            var entity     = Substitute.For <IAggregate>();
            var id         = entity.Id;
            var repository = new InMemoryTestRepository();

            repository.CurrentState.Add(entity);

            var foundEntity = repository.FindById(id);

            Assert.AreEqual(entity, foundEntity);
        }
        public void Cant_remove_non_added_entity()
        {
            var entity     = Substitute.For <AggregateRoot>();
            var repository = new InMemoryTestRepository();

            repository.Add(Substitute.For <AggregateRoot>());

            Assert.AreEqual(1, repository.CurrentState.Count);

            repository.Remove(entity);

            Assert.AreEqual(1, repository.CurrentState.Count);
        }
        public void Can_remove_entity()
        {
            var entity     = Substitute.For <IAggregate>();
            var repository = new InMemoryTestRepository();

            repository.Add(entity);

            Assert.AreEqual(1, repository.CurrentState.Count);

            repository.Remove(entity);

            Assert.AreEqual(0, repository.CurrentState.Count);
        }