コード例 #1
0
        public void SaveAndUpdate_Returns_dAsGuidWhereEntityIsIEntity()
        {
            var foo = new FooGuidTestWithIEntity {
                Something = "bar 1"
            };

            TestSession.Execute("DELETE FROM FooGuidTestWithIEntity");
            var repo = new FooRepo2(A.Fake <IDbFactory>());

            using (var uow = new Ioc.UnitOfWork.UnitOfWork(A.Fake <IDbFactory>(), TestSession))
            {
                repo.SaveOrUpdate(foo, uow);
            }
            var actual = repo.GetAll(TestSession);

            actual.Should().HaveCount(x => x > 0);
            actual.First().Id.Should().NotBe(new Guid());
        }
コード例 #2
0
        public void SaveAndUpdate_Returns_AsGuid()
        {
            var foo = new FooGuidTest {
                Something = "bar 1"
            };

            TestSession.Execute("Delete From FooGuidTest");
            var repo = new FooRepo1(A.Fake <IDbFactory>());

            using (var uow = new Ioc.UnitOfWork.UnitOfWork(A.Fake <IDbFactory>(), TestSession))
            {
                repo.SaveOrUpdate(foo, uow);
            }
            var actual = repo.GetAll(TestSession);

            actual.Should().HaveCount(x => x > 0);
            actual.First().Id.Should().NotBe(new Guid());
        }