public void CacheIsLocalToSubclass()
 {
     StringWriter sw = new StringWriter();
     FormatterOne f1 = new FormatterOne();
     FormatterTwo f2 = new FormatterTwo();
     DateTime dt1 = DateTime.Today.AddMinutes(10);
     f1.FormatDate(dt1, sw);
     f2.FormatDate(dt1, sw);
     Assert.AreEqual(2, FormatterOne.invocations);
 }
 public void CacheWorksForSameTicks()
 {
     StringWriter sw = new StringWriter();
     FormatterOne f1 = new FormatterOne();
     FormatterOne f2 = new FormatterOne();
     DateTime dt = DateTime.Now;
     f1.FormatDate(dt, sw);
     f2.FormatDate(dt, sw);
     Assert.AreEqual(1, FormatterOne.invocations);
 }
 public void CacheExpiresWhenCrossingSecond()
 {
     StringWriter sw = new StringWriter();
     FormatterOne f1 = new FormatterOne();
     FormatterOne f2 = new FormatterOne();
     DateTime dt1 = DateTime.Today.AddMinutes(1);
     DateTime dt2 = dt1.AddMilliseconds(1100);
     f1.FormatDate(dt1, sw);
     f2.FormatDate(dt2, sw);
     Assert.AreEqual(2, FormatterOne.invocations);
 }
 public void CacheWorksForSameSecond()
 {
     StringWriter sw = new StringWriter();
     FormatterOne f1 = new FormatterOne();
     FormatterOne f2 = new FormatterOne();
     DateTime dt1 = DateTime.Today;
     DateTime dt2 = dt1.AddMilliseconds(600);
     f1.FormatDate(dt1, sw);
     f2.FormatDate(dt2, sw);
     Assert.AreEqual(1, FormatterOne.invocations);
 }
示例#5
0
        public void CacheIsLocalToSubclass()
        {
            StringWriter sw  = new StringWriter();
            FormatterOne f1  = new FormatterOne();
            FormatterTwo f2  = new FormatterTwo();
            DateTime     dt1 = DateTime.Today.AddMinutes(10);

            f1.FormatDate(dt1, sw);
            f2.FormatDate(dt1, sw);
            Assert.AreEqual(2, FormatterOne.invocations);
        }
示例#6
0
        public void CacheWorksForSameTicks()
        {
            StringWriter sw = new StringWriter();
            FormatterOne f1 = new FormatterOne();
            FormatterOne f2 = new FormatterOne();
            DateTime     dt = DateTime.Now;

            f1.FormatDate(dt, sw);
            f2.FormatDate(dt, sw);
            Assert.AreEqual(1, FormatterOne.invocations);
        }
示例#7
0
        public void CacheExpiresWhenCrossingSecond()
        {
            StringWriter sw  = new StringWriter();
            FormatterOne f1  = new FormatterOne();
            FormatterOne f2  = new FormatterOne();
            DateTime     dt1 = DateTime.Today.AddMinutes(1);
            DateTime     dt2 = dt1.AddMilliseconds(1100);

            f1.FormatDate(dt1, sw);
            f2.FormatDate(dt2, sw);
            Assert.AreEqual(2, FormatterOne.invocations);
        }
示例#8
0
        public void CacheWorksForSameSecond()
        {
            StringWriter sw  = new StringWriter();
            FormatterOne f1  = new FormatterOne();
            FormatterOne f2  = new FormatterOne();
            DateTime     dt1 = DateTime.Today;
            DateTime     dt2 = dt1.AddMilliseconds(600);

            f1.FormatDate(dt1, sw);
            f2.FormatDate(dt2, sw);
            Assert.AreEqual(1, FormatterOne.invocations);
        }