public static void GetKey_Returns_WithoutJoinsWithoutIEntity()
        {
            var repo   = new NewRepository(Factory);
            New result = null;

            Assert.DoesNotThrow(() => result = repo.GetKey(1, Connection));
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Key, Is.EqualTo(1));
        }
        public static void GetKey_Returns_WithoutJoinsWithUnitOfWorkWithoutIEntity()
        {
            var repo   = new NewRepository(Factory);
            New result = null;

            using (var uow = Connection.UnitOfWork(IsolationLevel.Serializable))
            {
                Assert.DoesNotThrow(() => result = repo.GetKey(1, uow));
            }
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Key, Is.EqualTo(1));
        }
Пример #3
0
        public static void SaveOrUpdate_Returns_IdForUpdatedEnitityAndEntityWithoutIEntity()
        {
            var       repo       = new NewRepository(Factory);
            const int expectedId = 3;
            var       resultId   = 0;

            int?oridinalId;

            using (var uow = Connection.UnitOfWork(IsolationLevel.Serializable))
            {
                var expected = repo.GetKey(expectedId, uow);
                oridinalId       = expected.WorldId;
                expected.WorldId = 3;
                Assert.DoesNotThrow(() => resultId = repo.SaveOrUpdate(expected, uow));
            }
            Assert.That(expectedId, Is.EqualTo(resultId));
            var result = repo.GetKey(expectedId, Connection);

            Assert.That(result.WorldId, Is.Not.EqualTo(oridinalId));
            Assert.That(result.WorldId, Is.EqualTo(3));
        }