예제 #1
0
 public void UpdateLockedData2()
 {
     using (var container = new RhetosTestContainer())
     {
         var id1 = Guid.NewGuid();
         container.Resolve<ISqlExecuter>().ExecuteSql(new[] {
             "DELETE FROM TestMultipleLock.Simple",
             "DELETE FROM TestMultipleLock.PassDependency",
             "INSERT INTO TestMultipleLock.PassDependency (ID, MinPassLength) VALUES (" + SqlUtility.QuoteGuid(id1) + ", 5)"});
         var repository = container.Resolve<Common.DomRepository>();
         var pd = repository.TestMultipleLock.PassDependency.All().SingleOrDefault();
         var s1 = new TestMultipleLock.Simple { ID = Guid.NewGuid(), PassDependency = pd, UserName = "******", Pass = "******" };
         TestUtility.ShouldFail(() => repository.TestMultipleLock.Simple.Insert(new[] { s1 }), "Pass is not valid.");
     }
 }
예제 #2
0
        public void UpdateLockedData()
        {
            using (var executionContext = new CommonTestExecutionContext())
            {
                var id1 = Guid.NewGuid();
                executionContext.SqlExecuter.ExecuteSql(new[] {
                    "DELETE FROM TestMultipleLock.Simple",
                    "DELETE FROM TestMultipleLock.PassDependency",
                    "INSERT INTO TestMultipleLock.PassDependency (ID, MinPassLength) VALUES (" + SqlUtility.QuoteGuid(id1) + ", 5)"});
                var repository = new Common.DomRepository(executionContext);
                var pd = repository.TestMultipleLock.PassDependency.All().SingleOrDefault();
                var s1 = new TestMultipleLock.Simple { ID = Guid.NewGuid(), PassDependency = pd, UserName = "******", Pass = "******" };

                TestUtility.ShouldFail(() => repository.TestMultipleLock.Simple.Insert(new[] { s1 }), "Pass is too short.");
            }
        }
예제 #3
0
 public void UpdateLockedData4()
 {
     using (var container = new RhetosTestContainer())
     {
         var id1 = Guid.NewGuid();
         container.Resolve <ISqlExecuter>().ExecuteSql(new[] {
             "DELETE FROM TestMultipleLock.Simple",
             "DELETE FROM TestMultipleLock.PassDependency",
             "INSERT INTO TestMultipleLock.PassDependency (ID, MinPassLength) VALUES (" + SqlUtility.QuoteGuid(id1) + ", 5)"
         });
         var repository = container.Resolve <Common.DomRepository>();
         var pd         = repository.TestMultipleLock.PassDependency.All().SingleOrDefault();
         var s1         = new TestMultipleLock.Simple {
             ID = Guid.NewGuid(), PassDependencyID = pd.ID, UserName = "******", Pass = "******"
         };
         TestUtility.ShouldFail(() => repository.TestMultipleLock.Simple.Insert(new[] { s1 }), "Pass cannot contain UserName.");
     }
 }
예제 #4
0
 public void UpdateLockedData3()
 {
     using (var scope = TestScope.Create())
     {
         var id1 = Guid.NewGuid();
         scope.Resolve <ISqlExecuter>().ExecuteSql(new[] {
             "DELETE FROM TestMultipleLock.Simple",
             "DELETE FROM TestMultipleLock.PassDependency",
             "INSERT INTO TestMultipleLock.PassDependency (ID, MinPassLength) VALUES (" + SqlUtility.QuoteGuid(id1) + ", 5)"
         });
         var repository = scope.Resolve <Common.DomRepository>();
         var pd         = repository.TestMultipleLock.PassDependency.Load().SingleOrDefault();
         var s1         = new TestMultipleLock.Simple {
             ID = Guid.NewGuid(), PassDependencyID = pd.ID, UserName = "******", Pass = "******"
         };
         repository.TestMultipleLock.Simple.Insert(new[] { s1 });
     }
 }