public void WhenSavingEntityTwice_ThenCanReloadIt()
        {
            var id = Guid.NewGuid();

            using (var context = new SqlDataContext<TestAggregateRoot>(() => new TestDbContext(), Mock.Of<IEventBus>()))
            {
                var aggregateRoot = new TestAggregateRoot(id);
                context.Save(aggregateRoot);
            }

            using (var context = new SqlDataContext<TestAggregateRoot>(() => new TestDbContext(), Mock.Of<IEventBus>()))
            {
                var aggregateRoot = context.Find(id);
                aggregateRoot.Title = "test";

                context.Save(aggregateRoot);
            }

            using (var context = new SqlDataContext<TestAggregateRoot>(() => new TestDbContext(), Mock.Of<IEventBus>()))
            {
                var aggregateRoot = context.Find(id);

                Assert.Equal("test", aggregateRoot.Title);
            }
        }
        public void WhenSavingEntityTwice_ThenCanReloadIt()
        {
            var id = Guid.NewGuid();

            using (var context = new SqlDataContext <TestAggregateRoot>(() => new TestDbContext(), Mock.Of <IEventBus>()))
            {
                var aggregateRoot = new TestAggregateRoot(id);
                context.Save(aggregateRoot);
            }

            using (var context = new SqlDataContext <TestAggregateRoot>(() => new TestDbContext(), Mock.Of <IEventBus>()))
            {
                var aggregateRoot = context.Find(id);
                aggregateRoot.Title = "test";

                context.Save(aggregateRoot);
            }

            using (var context = new SqlDataContext <TestAggregateRoot>(() => new TestDbContext(), Mock.Of <IEventBus>()))
            {
                var aggregateRoot = context.Find(id);

                Assert.Equal("test", aggregateRoot.Title);
            }
        }
        public void WhenSavingAggregateRoot_ThenCanRetrieveIt()
        {
            var id = Guid.NewGuid();

            using (var context = new SqlDataContext<TestAggregateRoot>(() => new TestDbContext(), Mock.Of<IEventBus>()))
            {
                var aggregateRoot = new TestAggregateRoot(id) { Title = "test" };

                context.Save(aggregateRoot);
            }

            using (var context = new SqlDataContext<TestAggregateRoot>(() => new TestDbContext(), Mock.Of<IEventBus>()))
            {
                var aggregateRoot = context.Find(id);

                Assert.NotNull(aggregateRoot);
                Assert.Equal("test", aggregateRoot.Title);
            }
        }
        public void WhenSavingAggregateRoot_ThenCanRetrieveIt()
        {
            var id = Guid.NewGuid();

            using (var context = new SqlDataContext <TestAggregateRoot>(() => new TestDbContext(), Mock.Of <IEventBus>())) {
                var aggregateRoot = new TestAggregateRoot(id)
                {
                    Title = "test"
                };
                context.Save(aggregateRoot);
            }

            using (var context = new SqlDataContext <TestAggregateRoot>(() => new TestDbContext(), Mock.Of <IEventBus>())) {
                var aggregateRoot = context.Find(id);

                Assert.NotNull(aggregateRoot);
                Assert.AreEqual("test", aggregateRoot.Title);
            }
        }