Beispiel #1
0
        public void TestsDistributedIndentifier_VerifyUniqueGuidsIdsGeneratedInOrder()
        {
            Guid[] ids = new Guid[1000];

            for (int i = 0; i < 1000; i++)
            {
                ids[i] = DI.GenerateSequentialGuid();
            }

            Assert.IsTrue(TestAdmin.AreSorted(ids), "Guids needs to be ordered");

            Assert.IsTrue(TestAdmin.AreUnique(ids), "Guids are not unique");
        }
Beispiel #2
0
        public void TestsDistributedIndentifier_VerifyUnique64BitIdsGeneratedInOrder()
        {
            long[] ids = new long[1000];

            for (int i = 0; i < 1000; i++)
            {
                ids[i] = DI.GenerateSequential64Bit();
            }

            Assert.IsTrue(TestAdmin.AreSorted(ids), "Ids array needs to be ordered");

            Assert.IsTrue(TestAdmin.AreUnique(ids), "Ids array are not unique");
        }
Beispiel #3
0
        public void TestsDataContext_Make_Sure_Entities_With_Timestamp_Fields_Have_Concurrency_Switched_On()
        {
            var ctx1 = TestAdmin.TestContext();
            var ctx2 = TestAdmin.TestContext();

            ctx1.ReadOnly = false;
            ctx2.ReadOnly = false;
            ConcurrencyCheck <Business>(ctx1, ctx1.Businesses, ctx2, ctx2.Businesses);

            ctx1          = TestAdmin.TestContext();
            ctx2          = TestAdmin.TestContext();
            ctx1.ReadOnly = false;
            ctx2.ReadOnly = false;
            ConcurrencyCheck <User>(ctx1, ctx1.Users, ctx2, ctx2.Users);
        }
Beispiel #4
0
        public static void InitialiseTests(TestContext test)
        {
            string rootpath       = (AppDomain.CurrentDomain.BaseDirectory ?? Environment.CurrentDirectory) + @"\\..\\..\\..\\..\\";
            bool   recreateSchema = DPOContext.GenerateSQLCEedmx(rootpath, @"DPO.Tests\\DPO.Tests\\Context\\DPOContextTest.edmx");
            // file path of the database to create
            var dbTestFilePath = TestDatabasePath();

            if (recreateSchema)
            {
                throw new Exception("New Edmx Test file found and copied. Please publish the new database and compile code");
            }
            var context = TestAdmin.TestContext();

            //new SystemServices().SeedSystemDataDefaults();
            // new SystemTestDataServices().SeedSystemTestData();
        }
Beispiel #5
0
        public void CreateNewTestContext()
        {
            if (TContext != null && TContext.TransactionScope != null)
            {
                TContext.Rollback();
            }

            Console.WriteLine("Start before any Test");
            TContext = TestAdmin.TestContext();

            TContext.SetTransactional(System.Data.IsolationLevel.ReadUncommitted);

            db = new Repository(this.TContext);

            this.TContext.ReadOnly = false;
        }