Ejemplo n.º 1
0
        public void HourLogPathFactoryTest()
        {
            HourLogPathFactory factory = new HourLogPathFactory();
            var now = new DateTime(2015, 1, 5, 3, 0, 0);
            Assert.False(factory.IsCreated(now));
            Assert.Equal(GA.FullPath(LogFolder, "2015年01月","05", "03.log"), factory.CreatePath(now, LogFolder, ".log"));
            Assert.True(factory.IsCreated(now));
            now = now.AddDays(1);

            Assert.False(factory.IsCreated(now));
            Assert.Equal(GA.FullPath(LogFolder, "2015年01月", "06", "03.log"), factory.CreatePath(now, LogFolder, ".log"));
            Assert.True(factory.IsCreated(now));

            now = now.AddHours(1);

            Assert.False(factory.IsCreated(now));
            Assert.Equal(GA.FullPath(LogFolder, "2015年01月", "06", "04.log"), factory.CreatePath(now, LogFolder, ".log"));
            Assert.True(factory.IsCreated(now));
        }
Ejemplo n.º 2
0
        public void HourLogPathFactoryTest()
        {
            HourLogPathFactory factory = new HourLogPathFactory();
            var now = new DateTime(2015, 1, 5, 3, 0, 0);

            Assert.False(factory.IsCreated(now));
            Assert.Equal(GA.FullPath(LogFolder, "2015年01月", "05", "03.log"), factory.CreatePath(now, LogFolder, ".log"));
            Assert.True(factory.IsCreated(now));
            now = now.AddDays(1);

            Assert.False(factory.IsCreated(now));
            Assert.Equal(GA.FullPath(LogFolder, "2015年01月", "06", "03.log"), factory.CreatePath(now, LogFolder, ".log"));
            Assert.True(factory.IsCreated(now));

            now = now.AddHours(1);

            Assert.False(factory.IsCreated(now));
            Assert.Equal(GA.FullPath(LogFolder, "2015年01月", "06", "04.log"), factory.CreatePath(now, LogFolder, ".log"));
            Assert.True(factory.IsCreated(now));
        }