public void CohortSummary_GetStatus_Returns_Unknown_If_Unable_To_Find_The_Status()
        {
            var cohortSummary = new CohortSummary
            {
                CohortId  = 1,
                IsDraft   = true,
                WithParty = Party.Provider
            };

            var status = cohortSummary.GetStatus();

            Assert.AreEqual(CohortStatus.Unknown, status);
        }
        public void CohortSummary_GetStatus_Returns_Correct_Status_For_WithTrainingProvider()
        {
            var cohortSummary = new CohortSummary
            {
                CohortId  = 1,
                IsDraft   = false,
                WithParty = Party.Provider
            };

            var status = cohortSummary.GetStatus();

            Assert.AreEqual(CohortStatus.WithProvider, status);
        }
        public void CohortSummary_GetStatus_Returns_Correct_Status_For_Draft()
        {
            var cohortSummary = new CohortSummary
            {
                CohortId  = 1,
                IsDraft   = true,
                WithParty = Party.Employer
            };

            var status = cohortSummary.GetStatus();

            Assert.AreEqual(CohortStatus.Draft, status);
        }
        public void CohortSummary_GetStatus_Returns_Correct_Status(bool isDraft, Party withParty, CohortStatus cohortStatus)
        {
            //Arrange
            var cohortSummary = new CohortSummary
            {
                CohortId  = 1,
                IsDraft   = isDraft,
                WithParty = withParty
            };

            //Act
            var status = cohortSummary.GetStatus();

            //Assert
            Assert.AreEqual(cohortStatus, status);
        }
Example #5
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] != null)
            {
                _id     = Convert.ToInt32(Request.QueryString["id"]);
                _cohort = GetCohortGroup(_id);

                _cohortSummary = new CohortSummary()
                {
                    CohortGroupId = _id
                };

                txtCohortName.Value      = _cohort.CohortName;
                txtCohortCode.Value      = _cohort.CohortCode;
                txtCohortCondition.Value = _cohort.Condition != null ? _cohort.Condition.Description : "";
            }
            else
            {
                throw new Exception("id not passed as parameter");
            }
        }
 public static CohortStatus GetStatus(this CohortSummary cohort)
 {
     if (cohort.IsDraft && cohort.WithParty == Party.Employer)
     {
         return(CohortStatus.Draft);
     }
     else if (!cohort.IsDraft && cohort.WithParty == Party.Employer)
     {
         return(CohortStatus.Review);
     }
     else if (!cohort.IsDraft && cohort.WithParty == Party.Provider)
     {
         return(CohortStatus.WithProvider);
     }
     else if (!cohort.IsDraft && cohort.WithParty == Party.TransferSender)
     {
         return(CohortStatus.WithTransferSender);
     }
     else
     {
         return(CohortStatus.Unknown);
     }
 }
 private DateTime GetOrderByDate(CohortSummary s)
 {
     return(new[] { s.LatestMessageFromEmployer?.SentOn, s.LatestMessageFromProvider?.SentOn, s.CreatedOn }.Max().Value);
 }