コード例 #1
0
        private void AddBadFormatTimespanWithDayBeforeMonth()
        {
            var timeClock = new TimeClock("testUsuario");

            var badFormatDate = "20-10-2012 11:00";
            timeClock.AddTime(badFormatDate);
        }
コード例 #2
0
        private void AddBadFormatTimespan()
        {
            var timeClock = new TimeClock("testUsuario");

            var badFormatDate = "10-10-2012 111:00";
            timeClock.AddTime(badFormatDate);
        }
コード例 #3
0
        public void PostClocking(Clocking clocking)
        {
            var timeClock = TimeClockRepository.GetByUserName(clocking.UserName);

            if (timeClock == null)
                timeClock = new TimeClock(clocking.UserName);

            timeClock.AddTime(clocking.Date);

               TimeClockRepository.Store(timeClock);
        }
コード例 #4
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"));
        }
コード例 #5
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"));
        }
コード例 #6
0
        public void GetTimeClock_PassingAnUserNameThatExistis_ReturnATimeClock()
        {
            //arrange
            var userName = "Nobody";

            var expectedTimeClock = new TimeClock(userName);

            var mockTimeClockRepository = new Moq.Mock<ITimeClockRepository>();
            mockTimeClockRepository.Setup(x => x.GetByUserName(userName)).Returns(expectedTimeClock);

            var timeClockController = new TimeClockController(mockTimeClockRepository.Object);

            //act
            timeClockController.GetTimeClock(userName);

            //assert
            mockTimeClockRepository.VerifyAll();
        }
コード例 #7
0
        public void PostClocking_WithoutKnownTimeClock_ShouldCreateATimeClock()
        {
            //arrange
            var clocking = new Clocking() { Date = "10-10-2012 11:11", UserName = "Testador" };
            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();
        }
コード例 #8
0
ファイル: TimeClock.cs プロジェクト: GabrielMCardozo/WorkLog
 protected bool Equals(TimeClock other)
 {
     return string.Equals(UserName, other.UserName) &&
            Enumerable.SequenceEqual(CheckedTimes.OrderBy(x => x), other.CheckedTimes.OrderBy(x => x));
 }
コード例 #9
0
 public void TimeClock_InicializaComUserName()
 {
     var userName = "testUsuario";
     var timeClock = new TimeClock(userName);
     Assert.AreEqual(userName, timeClock.UserName);
 }