public void PanelMemberCanCommentAllegation() { var caseWorker = Database.CreateActiveUser("*****@*****.**", Role.CaseWorker); var panelMember1 = Database.CreateActiveUser("*****@*****.**", Role.PanelMember); var panelMember2 = Database.CreateActiveUser("*****@*****.**", Role.PanelMember); var panelMember3 = Database.CreateActiveUser("*****@*****.**", Role.PanelMember); var caseWorkerLogin = UserManagementTests.Login(caseWorker.Email, Database.Password, Database.Phrase); var panelMemberLogin = UserManagementTests.Login(panelMember1.Email, Database.Password, Database.Phrase); var caseData = CreateCase(1); var client = DefaultUser.CreateWebApiClient(); client.UpdateUserAssigments(caseWorkerLogin.SecurityToken, caseWorker.Id, caseData.Id); client.UpdateUserAssigments(caseWorkerLogin.SecurityToken, panelMember1.Id, caseData.Id); var caseUpdate = new Server.Contract.Cases.CaseUpdate { Initial = new InitialCaseDataUpdate { Background = "a", IdealOutcome = "a", PanelMembers = new PanelMembersUpdate { PanelMember1 = panelMember1.Id, PanelMember2 = panelMember2.Id, PanelMember3 = panelMember3.Id, }, IssueRaisedWithArchitect = new Question { Answer = false, Comments = "a", }, SubjectOfLegalProceedings = new Question { Answer = false, Comments = "a", }, StartDate = DateTime.Today.AddDays(-1), }, AllegationsUpdate = new AllegationsUpdate { NewAllegations = new[] { new NewAllegation { Id = Guid.NewGuid(), Text = "Allegation", Documents = new NewDocument[0], }, }, DeletedAllegations = new Guid[0], } }; client.UpdateCase(caseWorkerLogin.SecurityToken, caseData.Id, caseUpdate); client.StartCaseProcessing(caseWorkerLogin.SecurityToken, caseData.Id); client.CommentAllegation(panelMemberLogin.SecurityToken, caseUpdate.AllegationsUpdate.NewAllegations[0].Id, "comment", AllegationCommentType.Yes, null); var @case = client.GetCase(panelMemberLogin.SecurityToken, caseData.Id); Assert.AreEqual(AllegationCommentType.Yes, @case.Allegations.Items[0].MyComment.AllegationCommentType); Assert.AreEqual("comment", @case.Allegations.Items[0].MyComment.Text); }
public void CanUpdateCase() { var caseData = CreateCase(1); var login = DefaultUser.Login(); var client = DefaultUser.CreateWebApiClient(); var pm1 = Database.CreateActiveUser("*****@*****.**", Role.PanelMember); var pm2 = Database.CreateActiveUser("*****@*****.**", Role.PanelMember); var pm3 = Database.CreateActiveUser("*****@*****.**", Role.PanelMember); var pm4 = Database.CreateActiveUser("*****@*****.**", Role.PanelMember); var caseUpdate = new Server.Contract.Cases.CaseUpdate { Initial = new Server.Contract.Cases.InitialCaseDataUpdate { StartDate = DateTime.Now, PanelMembers = new Server.Contract.Cases.PanelMembersUpdate { PanelMember1 = pm1.Id, PanelMember2 = pm2.Id, PanelMember3 = null, }, IssueRaisedWithArchitect = new Server.Contract.Cases.Question { Answer = true, Comments = "text bla bla bla", }, SubjectOfLegalProceedings = new Server.Contract.Cases.Question(), }, Contacts = new Server.Contract.Cases.CaseContacts { ArchitectContact = new Server.Contract.Cases.ArchitectContact(), ClaimantContact = new Server.Contract.Cases.Contact(), }, AllegationsUpdate = new Server.Contract.Cases.AllegationsUpdate { DeletedAllegations = new Guid[0], NewAllegations = new Server.Contract.Cases.NewAllegation[0], }, DatesAndDetailsUpdate = new Server.Contract.Cases.DateAndDetailUpdate { DeletedDatesAndDetails = new Guid[0], NewDatesAndDetails = new Server.Contract.Cases.NewDateAndDetail[0], } }; client.UpdateCase(login.SecurityToken, caseData.Id, caseUpdate); var case1 = client.GetCase(login.SecurityToken, caseData.Id); Assert.AreEqual(Server.Contract.Cases.CaseStateKind.New, case1.ReadonlyData.State.StateKind); Assert.AreEqual(caseUpdate.Initial.StartDate, case1.InitialData.StartDate); var membersExpected = new[] {caseUpdate.Initial.PanelMembers.PanelMember1.Value, caseUpdate.Initial.PanelMembers.PanelMember2.Value}.OrderBy( item => item).ToArray(); var membersActual = new[] {case1.InitialData.CasePanelMembers.PanelMember1.Id, case1.InitialData.CasePanelMembers.PanelMember2.Id} .OrderBy(item => item).ToArray(); Assert.AreEqual(membersExpected[0], membersActual[0]); Assert.AreEqual(membersExpected[1], membersActual[1]); Assert.IsNull(caseUpdate.Initial.PanelMembers.PanelMember3); caseUpdate.Initial.PanelMembers.PanelMember1 = pm3.Id; caseUpdate.Initial.PanelMembers.PanelMember3 = pm4.Id; client.UpdateCase(login.SecurityToken, caseData.Id, caseUpdate); var case2 = client.GetCase(login.SecurityToken, caseData.Id); Assert.AreEqual(Server.Contract.Cases.CaseStateKind.New, case2.ReadonlyData.State.StateKind); membersExpected = new[] { caseUpdate.Initial.PanelMembers.PanelMember1.Value, caseUpdate.Initial.PanelMembers.PanelMember2.Value, caseUpdate.Initial.PanelMembers.PanelMember3.Value }.OrderBy( item => item).ToArray(); membersActual = new[] { case2.InitialData.CasePanelMembers.PanelMember1.Id, case2.InitialData.CasePanelMembers.PanelMember2.Id , case2.InitialData.CasePanelMembers.PanelMember3.Id, } .OrderBy(item => item).ToArray(); Assert.AreEqual(membersExpected[0], membersActual[0]); Assert.AreEqual(membersExpected[1], membersActual[1]); Assert.AreEqual(membersExpected[2], membersActual[2]); }