public void CanCreateAndGetCase() { var caseData = new Integrator.CaseData { Id = 10, CaseManagerEmail = DefaultUser.Email, ClaimantContact = new Integrator.CaseData.ContactData { Name = "name", EMail = "*****@*****.**", Address = "address", Phone = "+375297775218", }, StartDate = DateTime.Now, }; var destination = new Destination(ConfigurationManager.AppSettings["WebApiUrl"]); destination.CreateCase(caseData); var client = DefaultUser.CreateWebApiClient(); var login = DefaultUser.Login(); var readCase = client.GetCase(login.SecurityToken, caseData.Id); Assert.IsNotNull(readCase); Assert.AreEqual(Server.Contract.Cases.CaseStateKind.New, readCase.ReadonlyData.State.StateKind); Assert.AreEqual(caseData.Id, readCase.ReadonlyData.Id); Assert.AreEqual(caseData.ClaimantContact.EMail, readCase.Contacts.ClaimantContact.EMail); Assert.AreEqual(caseData.ClaimantContact.Address, readCase.Contacts.ClaimantContact.Address); Assert.AreEqual(caseData.ClaimantContact.Name, readCase.Contacts.ClaimantContact.Name); Assert.AreEqual(caseData.ClaimantContact.Phone, readCase.Contacts.ClaimantContact.Phone); Assert.IsNull(readCase.Contacts.ArchitectContact.Name); Assert.IsNull(readCase.Contacts.ArchitectContact.Address); Assert.IsNull(readCase.Contacts.ArchitectContact.EMail); Assert.IsNull(readCase.Contacts.ArchitectContact.Phone); Assert.IsNull(readCase.Contacts.ArchitectContact.RegistrationNumber); Assert.IsNull(readCase.InitialData.Background); Assert.IsNull(readCase.Contacts.Relationship); Assert.IsNull(readCase.InitialData.IdealOutcome); Assert.IsNull(readCase.Contacts.ContactAgreement); Assert.AreEqual(0, readCase.Allegations.Items.Length); Assert.AreEqual(0, readCase.DatesAndDetails.Length); }
private static Integrator.CaseData CreateCase(int id) { var caseData = new Integrator.CaseData { Id = id, CaseManagerEmail = DefaultUser.Email, ClaimantContact = new Integrator.CaseData.ContactData { Name = "name", EMail = "*****@*****.**", Address = "address", Phone = "+375297775218", }, StartDate = DateTime.Now, }; var destination = new Destination(ConfigurationManager.AppSettings["WebApiUrl"]); destination.CreateCase(caseData); return caseData; }
public void CanAddPreliminaryDecisionDocument() { var caseData = new Integrator.CaseData { Id = 10, CaseManagerEmail = DefaultUser.Email, ClaimantContact = new Integrator.CaseData.ContactData { Name = "name", EMail = "*****@*****.**", Address = "address", Phone = "+375297775218", }, StartDate = DateTime.Now, }; var destination = new Destination(ConfigurationManager.AppSettings["WebApiUrl"]); destination.CreateCase(caseData); var caseWorker = Database.CreateActiveUser("*****@*****.**", Role.CaseWorker); var caseWorkerToken = UserManagementTests.Login(caseWorker.Email, Database.Password, Database.Phrase).SecurityToken; var client = DefaultUser.CreateWebApiClient(); client.AddPreliminaryDecision(caseWorkerToken, caseData.Id, new NewDocument {Id = Guid.NewGuid(), Name = "document", Body = new byte[] {1, 2, 3}}); var documents = client.GetCaseDocuments(caseWorkerToken, caseData.Id); var @case = client.GetCase(caseWorkerToken, caseData.Id); Assert.AreEqual(1, documents.Length); Assert.AreEqual("document", documents[0].Name); Assert.AreEqual("document", @case.PreliminaryDecisionDocument.Name); var doc = client.GetDocument(caseWorkerToken, documents[0].Id); Console.WriteLine(doc.Body.Length); }
public void CanAddAndGetPartiesComments() { var caseData = new Integrator.CaseData { Id = 10, CaseManagerEmail = DefaultUser.Email, ClaimantContact = new Integrator.CaseData.ContactData { Name = "name", EMail = "*****@*****.**", Address = "address", Phone = "+375297775218", }, StartDate = DateTime.Now, }; var destination = new Destination(ConfigurationManager.AppSettings["WebApiUrl"]); destination.CreateCase(caseData); var caseWorker = Database.CreateActiveUser("*****@*****.**", Role.CaseWorker); var caseWorkerToken = UserManagementTests.Login(caseWorker.Email, Database.Password, Database.Phrase).SecurityToken; var client = DefaultUser.CreateWebApiClient(); client.AddPartiesComment(caseWorkerToken, caseData.Id, "supertext", new NewDocument[] { new NewDocument { Id = Guid.NewGuid(), Name = "document1", Body = new byte[] {1, 2, 3, 4, 5}, }, new NewDocument { Id = Guid.NewGuid(), Name = "document2", Body = new byte[] {6, 7, 8, 9, 10}, } }); var login = DefaultUser.Login(); var readCase = client.GetCase(login.SecurityToken, caseData.Id); Assert.AreEqual(1, readCase.PartiesComments.Length); Assert.AreEqual("supertext", readCase.PartiesComments[0].Text); Assert.AreEqual(2, readCase.PartiesComments[0].Documents.Length); var documentNames = readCase.PartiesComments[0].Documents.Select(x => x.Name).OrderBy(x => x).ToArray(); Assert.AreEqual("document1", documentNames[0]); Assert.AreEqual("document2", documentNames[1]); }