Пример #1
0
        public void TestSimpleCache()
        {
            Room r = new Room { Uri = new Uri(Path.Combine(Directory.GetCurrentDirectory(), "../../fixture/RES-PHAR-129.ics")), RoomNumber = "RES-PHAR-129" };
            r.Load(r.Uri);

            List<SimpleEvent> se;

            SystemTime.Now = () => DateTime.Today; //without this line, this test fails if it runs after another test because of some weird bug
            se = r.CacheToSimple();
            Assert.AreEqual<int>(0, se.Count); //should evaluate to true after 9/4/2013 because that day is the last event in the fixture
            se.Clear();

            se = r.CacheToSimple(new DateTime(2013, 8, 8, 17, 0, 0));
            Assert.AreEqual<int>(2, se.Count);
            se.Clear();

            se = r.CacheToSimple(new DateTime(2013, 8, 26), new DateTime(2013, 9, 4));
            Assert.AreEqual<int>(5, se.Count);
            se.Clear();

            se = r.CacheToSimple(new DateTime(2013, 8, 1), 6);
            Assert.AreEqual<int>(2, se.Count);
        }
Пример #2
0
        public void TestSimpleCacheException()
        {
            Room r = new Room { Uri = new Uri(Path.Combine(Directory.GetCurrentDirectory(), "../../fixture/RES-PHAR-129.ics")), RoomNumber = "RES-PHAR-129" };
            //r.Load(r.Uri);

            List<SimpleEvent> se = r.CacheToSimple(new DateTime(2013, 8, 8, 17, 0, 0));
        }