Exemplo n.º 1
0
        private void AddBadFormatTimespanWithDayBeforeMonth()
        {
            var timeClock = new TimeClock("testUsuario");

            var badFormatDate = "20-10-2012 11:00";
            timeClock.AddTime(badFormatDate);
        }
Exemplo n.º 2
0
        private void AddBadFormatTimespan()
        {
            var timeClock = new TimeClock("testUsuario");

            var badFormatDate = "10-10-2012 111:00";
            timeClock.AddTime(badFormatDate);
        }
Exemplo n.º 3
0
        public void AddTime_SomeTimespanWithPeriodAsHourMinutesSeparator()
        {
            var timeClock = new TimeClock("testUsuario");

            var date = "10-20-2012 12.12";

            //act
            timeClock.AddTime(date);

            //assert
            var actualTimespan = timeClock.CheckedTimes[0];
            Assert.AreEqual(date, actualTimespan.ToString("MM-dd-yyyy hh.mm"));
        }
Exemplo n.º 4
0
        public void AddTime_SomeTimespan()
        {
            //arrange
            var timeClock = new TimeClock("testUsuario");

            var date = "10-20-2012 12:12";

            //act
            timeClock.AddTime(date);

            //assert
            var actualTimespan = timeClock.CheckedTimes[0];
            Assert.AreEqual(date,actualTimespan.ToString("MM-dd-yyyy hh:mm"));
        }
        public void PostClocking_WithoutKnownTimeClock_ShouldCreateATimeClock()
        {
            //arrange
            var clocking = new Clocking() { Date = "10-10-2012 11:11", UserName = "******" };
            var expectedTimeClock = new TimeClock(clocking.UserName);
            expectedTimeClock.AddTime(clocking.Date);

            var mockTimeClockRepository = new Moq.Mock<ITimeClockRepository>();
            mockTimeClockRepository.Setup(x => x.GetByUserName(clocking.UserName)).Returns<TimeClock>(null);
            mockTimeClockRepository.Setup(x => x.Store(expectedTimeClock));

            var clockingController = new ClockingController(mockTimeClockRepository.Object);

            //act
            clockingController.PostClocking(clocking);

            //assert
            mockTimeClockRepository.VerifyAll();
        }