Ejemplo n.º 1
0
        public void Check_WhenCalledWithY2KShimDateTime_ThenApplicationExceptionIsThrowned()
        {
            using (ShimsContext.Create())
            {
                Y2KShimDateTime shim = new Y2KShimDateTime();

                Y2KChecker.Check();
            }
        }
Ejemplo n.º 2
0
        public void Check_WhenCalledWithTheDate_2000_1_1_ThenApplicationExceptionIsThrowned()
        {
            using (ShimsContext.Create())
            {
                ShimDateTime.NowGet = () => { return(new DateTime(2000, 1, 1)); };

                Y2KChecker.Check();
            }
        }
Ejemplo n.º 3
0
        public void Check_WhenCalledWithVY2KShimDateTime_ThenApplicationExceptionIsThrowned()
        {
            using (ShimsContext.Create())
            {
                Mock <VY2KShimDateTime> mock = new Mock <VY2KShimDateTime>();
                mock.Object.InitFake();
                mock.Setup(v => v.VNowGet()).Returns(new DateTime(2000, 1, 1));

                Y2KChecker.Check();
            }
        }
Ejemplo n.º 4
0
        public void Check_WhenCalledWithVY2KShimDateTime_ThenWeCanVerifyTheCalls()
        {
            using (ShimsContext.Create())
            {
                Mock <VY2KShimDateTime> mock = new Mock <VY2KShimDateTime>();
                mock.Object.InitFake();
                mock.Setup(v => v.VNowGet()).Returns(new DateTime(1, 1, 1));

                Y2KChecker.Check();

                //Uncomment line below to see verify that mock.Verify throws correct message
                //Y2KChecker.Check();

                mock.Verify(v => v.VNowGet(), Times.Once());
            }
        }