コード例 #1
0
        public void ThirteenWeekCaseIsApprovedAndDenied()
        {
            EmployeeCase theCase = LogicAndDataAccess.CreateCase(1, new DateTime(2017, 1, 2), new DateTime(2017, 3, 31));

            Assert.IsTrue(theCase.Approved);
            Assert.IsTrue(theCase.Denied);
        }
コード例 #2
0
        public void OneWeekCaseIsApproved()
        {
            EmployeeCase theCase = LogicAndDataAccess.CreateCase(1, new DateTime(2017, 1, 2), new DateTime(2017, 1, 6));

            Assert.IsTrue(theCase.Approved);
            Assert.IsFalse(theCase.Denied);
        }
コード例 #3
0
        public void CaseNumberIsNotDuplicate()
        {
            EmployeeCase firstCase  = LogicAndDataAccess.CreateCase(1, DateTime.UtcNow, DateTime.UtcNow.AddDays(7));
            EmployeeCase secondCase = LogicAndDataAccess.CreateCase(1, DateTime.UtcNow, DateTime.UtcNow.AddDays(7));

            Assert.AreNotEqual(firstCase.CaseNumber, secondCase.CaseNumber);
        }
コード例 #4
0
        public void CaseNumberIsTenCharactersExactly()
        {
            EmployeeCase theCase = new EmployeeCase();

            theCase.GenerateCaseNumber();
            Assert.AreEqual(10, theCase.CaseNumber.Length);
        }
コード例 #5
0
        public JsonResult CreateCase(CaseViewModel newCase)
        {
            EmployeeCase theCase = LogicAndDataAccess.CreateCase(newCase.EmployeeId, newCase.StartDate.Value, newCase.EndDate.Value);

            newCase.Approved = theCase.Approved;
            newCase.Denied   = theCase.Denied;
            return(Json(newCase));
        }
コード例 #6
0
        public void CaseNumberIsAlphaNumericOnly()
        {
            EmployeeCase theCase = new EmployeeCase();

            theCase.GenerateCaseNumber();

            Assert.IsNotNull(theCase.CaseNumber);

            Regex r = new Regex("^[a-zA-Z0-9]*$");

            Assert.IsTrue(r.IsMatch(theCase.CaseNumber));
        }
コード例 #7
0
        public void SecondCaseIsApprovedAndDenied()
        {
            // 11 week case
            EmployeeCase firstCase = LogicAndDataAccess.CreateCase(1, new DateTime(2017, 1, 2), new DateTime(2017, 3, 17));

            Assert.IsTrue(firstCase.Approved);
            Assert.IsFalse(firstCase.Denied);

            // two week case
            EmployeeCase secondCase = LogicAndDataAccess.CreateCase(1, new DateTime(2017, 3, 20), new DateTime(2017, 3, 31));

            Assert.IsTrue(secondCase.Approved);
            Assert.IsTrue(secondCase.Denied);
        }
コード例 #8
0
ファイル: CaseViewModel.cs プロジェクト: goverdhan1/takeHome
        public CaseViewModel(EmployeeCase theCase)
            : this()
        {
            if (theCase == null)
            {
                return;
            }

            Id         = theCase.Id;
            EmployeeId = theCase.EmployeeId;
            FirstName  = theCase.FirstName;
            LastName   = theCase.LastName;
            CaseNumber = theCase.CaseNumber;
            StartDate  = theCase.StartDate;
            EndDate    = theCase.EndDate;
            Approved   = theCase.Approved;
            Denied     = theCase.Denied;
        }