Ejemplo n.º 1
0
        public void EmptySetsYieldNoResults()
        {
            using (var context = TestDwhDbContext.CreateDWHDbContext()) {
                var testRepo = new SatelliteRepository <S_TestSatellite_Default>(context, HashFunctions.MD5);

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

                testList = testRepo.GetAll();
                Assert.Empty(testList);
            }
        }
Ejemplo n.º 2
0
        public void TestQueriesAndInsert()
        {
            using (var context = TestDwhDbContext.CreateDWHDbContext()) {
                var hubRepo       = new HubRepository <H_TestHub_Default>(context, HashFunctions.MD5, null);
                var satelliteRepo = new SatelliteRepository <S_TestSatellite_Default>(context, HashFunctions.MD5);

                var loadDate = DateTime.Now;

                hubRepo.Insert(TestHub1, loadDate);
                hubRepo.Insert(TestHub2, loadDate);

                var hubList = hubRepo.Get();
                Assert.NotEmpty(hubList);
                Assert.Equal(2, hubList.Count());


                satelliteRepo.Insert(Hub1Satellite1, loadDate);
                satelliteRepo.Insert(Hub2Satellite1, loadDate);

                var satelliteList = satelliteRepo.GetCurrent();
                Assert.NotEmpty(satelliteList);
                Assert.Equal(2, satelliteList.Count());

                //increment load date to simulate later insert of new data slice
                loadDate = loadDate.AddDays(1);

                satelliteRepo.Insert(Hub1Satellite2, loadDate);
                satelliteRepo.Insert(Hub2Satellite2, loadDate);

                satelliteList = satelliteRepo.GetCurrent();
                Assert.NotEmpty(satelliteList);
                Assert.Equal(2, satelliteList.Count());

                var satHub1 = satelliteList.Where(sat => sat.TestNr == TestHubBusinessKey1).Single();
                var satHub2 = satelliteList.Where(sat => sat.TestNr == TestHubBusinessKey2).Single();

                Assert.Equal(Hub1Satellite2, satHub1);
                Assert.Equal(Hub2Satellite2, satHub2);


                // a total of 4 should now be stored in the db
                satelliteList = satelliteRepo.GetAll();
                Assert.NotEmpty(satelliteList);
                Assert.Equal(4, satelliteList.Count());
            }
        }