コード例 #1
0
        public void TestQueriesAndInsert()
        {
            using (var context = TestDwhDbContext.CreateDWHDbContext()) {
                var testRepo = new HubRepository <H_TestHub_Default>(context, HashFunctions.MD5, null);
                var loadDate = DateTime.Now;

                //Bulk insert
                testRepo.Insert(testInstances, loadDate);

                var testList = testRepo.Get();
                Assert.NotEmpty(testList);
                Assert.Equal(testInstances.Count, testList.Count());
                Assert.Equal(testInstances.Count, testRepo.Count());

                var test = testRepo.GetByKey(AdditionalTest.PrimaryKey);
                Assert.Null(test);

                //additional insert
                testRepo.Insert(AdditionalTest, loadDate);

                testList = testRepo.Get();
                Assert.NotEmpty(testList);
                Assert.Equal(testInstances.Count + 1, testList.Count());
            }
        }
コード例 #2
0
        public void TestQueriesAndInsert()
        {
            using (var context = TestDwhDbContext.CreateDWHDbContext()) {
                var hubRepo       = new HubRepository <H_TestHub_Stores>(context, HashFunctions.MD5, null);
                var satelliteRepo = new SatelliteRepository <S_TestSatellite_Stores>(context, HashFunctions.MD5);
                var linkRepo      = new LinkRepository <L_TestLink_Stores>(context, HashFunctions.MD5, null, DVKeyCaching.Disabled);

                var loadDate = DateTime.Now;

                // HUB - storing info
                hubRepo.Insert(TestHub1, loadDate, loadInformation: LoadInfo1);

                var hub = hubRepo.GetByKey(TestHub1.PrimaryKey);

                Assert.Equal(LoadInfo1.RecordSource, hub.RecordSource);
                Assert.Equal(LoadInfo1.LoadedBy, hub.LoadedBy);

                // SATELLITE - storing info
                Hub1Satellite1 = satelliteRepo.Insert(Hub1Satellite1, loadDate, loadInformation: LoadInfo1);

                var sat = satelliteRepo.GetCurrent(s => s.Reference == TestHub1.PrimaryKey).Single();

                Assert.Equal(LoadInfo1.RecordSource, sat.RecordSource);
                Assert.Equal(LoadInfo1.LoadedBy, sat.LoadedBy);

                // LINK - storing info
                Link1 = linkRepo.Insert(Link1, loadDate, loadInformation: LoadInfo1);

                var link = linkRepo.GetByKey(Link1.PrimaryKey);

                Assert.Equal(LoadInfo1.RecordSource, link.RecordSource);
                Assert.Equal(LoadInfo1.LoadedBy, link.LoadedBy);
            }
        }
コード例 #3
0
        public void EmptySetsYieldNoResults()
        {
            using (var context = TestDwhDbContext.CreateDWHDbContext()) {
                var testRepo = new HubRepository <H_TestHub_Default>(context, HashFunctions.MD5, null);

                var testList = testRepo.Get();
                Assert.Empty(testList);

                var test = testRepo.GetByKey("UnknownId");
                Assert.Null(test);
            }
        }