public static string Case(this IQueryWithParams query, Action <CaseBuilder> builder) { var cb = new CaseBuilder(); builder(cb); return(cb.ToString(query)); }
public async Task GetCase_ShouldMapMarriageStatus() { // Arrange var entity = new CaseBuilder() .WithIntegrationFormField("firstname", "First name") .WithIntegrationFormField("surname", "Surname") .WithIntegrationFormField("marriedorinacivilpartnership", "Yes") .WithIntegrationFormField("dateofreg", "26/06/2019") .WithIntegrationFormField("datesetuphousehold", "26/06/2019") .Build(); _verintServiceGatewayMock .Setup(_ => _.GetCase(It.IsAny <string>())) .ReturnsAsync(new HttpResponse <Case> { StatusCode = HttpStatusCode.OK, ResponseContent = entity }); // Act var result = await _caseService.GetCase("1234"); // Assert Assert.True(result.MarriedOrInACivilPartnership); Assert.Equal(DateTime.Parse("26/06/2019"), result.DateOfMarriage); Assert.Equal(DateTime.Parse("26/06/2019"), result.DateMovedInTogether); }
public void CreateAddressHistoryList_ShouldMapSingleAddressWhenFieldsAreNotNull() { // Arrange var addressLine1 = "line1"; var addressLine2 = "line2"; var addressLineTown = "town"; var addressLineCounty = "county"; var addressLineCountry = "country"; var addressLinePostcode = "pstcode"; var year = "2010"; var month = "01"; var date = new DateTime(int.Parse(year), int.Parse(month), 01); var builder = new CaseBuilder() .WithIntegrationFormField("pa1applicant1", $"{addressLine1}|{addressLine2}|{addressLineTown}|{addressLineCounty}|{addressLineCountry}") .WithIntegrationFormField("pa1postcodeapplicant1", addressLinePostcode) .WithIntegrationFormField("pa1datefrommonthapplicant1", month) .WithIntegrationFormField("pa1datefromyearapplicant1", year) .Build(); // Act var result = _helper.CreateAddressHistoryList(builder.IntegrationFormFields); // Assert Assert.Equal(2, result.Count); Assert.Equal(addressLine1, result[1].Address.AddressLine1); Assert.Equal(addressLine2, result[1].Address.AddressLine2); Assert.Equal(addressLineTown, result[1].Address.Town); Assert.Equal(addressLineCounty, result[1].Address.County); Assert.Equal(addressLineCountry, result[1].Address.Country); Assert.Equal(addressLinePostcode, result[1].Address.Postcode); Assert.Equal(addressLinePostcode, result[1].Address.Postcode); Assert.Equal(date, result[1].DateFrom); }
public async Task GetCase_ShouldReturn_FosteringCaseWithParsedDateTime() { // Arrange var entity = new CaseBuilder() .WithIntegrationFormField("religionorfaithgroup", "Religion") .WithIntegrationFormField("sexualorientation", "Sexual orientation") .WithIntegrationFormField("gender", "Gender") .WithIntegrationFormField("ethnicity", "Ethnicity") .WithIntegrationFormField("nationality", "Nationality") .WithIntegrationFormField("previousname", "Previous name") .WithIntegrationFormField("surname", "Last Name") .WithIntegrationFormField("firstname", "First Name") .WithIntegrationFormField("dateofthehomevisit", "26/06/2019") .WithIntegrationFormField("timeofhomevisit", "13:30") .Build(); _verintServiceGatewayMock .Setup(_ => _.GetCase(It.IsAny <string>())) .ReturnsAsync(new HttpResponse <Case> { StatusCode = HttpStatusCode.OK, ResponseContent = entity }); // Act var result = await _caseService .GetCase("1234"); // Assert Assert.IsType <FosteringCase>(result); Assert.Equal(DateTime.Parse("26/06/2019 13:30"), result.HomeVisitDateTime); }
public void CreateAddressHistoryList_ShouldMapMultipleAdditionalInformationWhenFieldsAreNotNull() { // Arrange var additional = "Line1|Line2|Town|County|Country|Postcode|3|2016—2Line1|2Line2|2Town|2County|2Country|2Postcode|6|2010"; var date1 = new DateTime(int.Parse("2016"), int.Parse("3"), 01); var date2 = new DateTime(int.Parse("2010"), int.Parse("6"), 01); var builder = new CaseBuilder() .WithIntegrationFormField("addressadditionalinformation1", $"{additional}") .Build(); // Act var result = _helper.CreateAddressHistoryList(builder.IntegrationFormFields); // Assert Assert.Equal(3, result.Count); Assert.Equal("Line1", result[1].Address.AddressLine1); Assert.Equal("Line2", result[1].Address.AddressLine2); Assert.Equal("Town", result[1].Address.Town); Assert.Equal("County", result[1].Address.County); Assert.Equal("Country", result[1].Address.Country); Assert.Equal("Postcode", result[1].Address.Postcode); Assert.Equal(date1, result[1].DateFrom); Assert.Equal("2Line1", result[2].Address.AddressLine1); Assert.Equal("2Line2", result[2].Address.AddressLine2); Assert.Equal("2Town", result[2].Address.Town); Assert.Equal("2County", result[2].Address.County); Assert.Equal("2Country", result[2].Address.Country); Assert.Equal("2Postcode", result[2].Address.Postcode); Assert.Equal(date2, result[2].DateFrom); }
public async Task GetCase_ShouldMapPreviouslyApplied_ForBothApplicants() { // Arrange var entity = new CaseBuilder() .WithIntegrationFormField("firstname", "First name") .WithIntegrationFormField("surname", "Surname") .WithIntegrationFormField("withpartner", "Yes") .WithIntegrationFormField("firstname_2", "First name") .WithIntegrationFormField("surname_2", "Surname") .WithIntegrationFormField("previouslyappliedapplicant1", "yes") .WithIntegrationFormField("previouslyappliedapplicant2", "no") .Build(); _verintServiceGatewayMock .Setup(_ => _.GetCase(It.IsAny <string>())) .ReturnsAsync(new HttpResponse <Case> { StatusCode = HttpStatusCode.OK, ResponseContent = entity }); // Act var result = await _caseService.GetCase("1234"); // Assert Assert.True(result.FirstApplicant.PreviouslyApplied); Assert.False(result.SecondApplicant.PreviouslyApplied); }
public async Task GetCase_ShouldMapTypesOfFostering() { // Arrange var entity = new CaseBuilder() .WithIntegrationFormField("surname", "Last Name") .WithIntegrationFormField("firstname", "First Name") .WithIntegrationFormField("fiichildrenwithdisability", "ChildrenWithDisability") .WithIntegrationFormField("fiirespite", "Respite") .WithIntegrationFormField("fiishortterm", "ShortTerm") .WithIntegrationFormField("fiilongterm", "LongTerm") .WithIntegrationFormField("fiiunsure", "Unsure") .WithIntegrationFormField("fiishortbreaks", "ShortBreaks") .Build(); _verintServiceGatewayMock .Setup(_ => _.GetCase(It.IsAny <string>())) .ReturnsAsync(new HttpResponse <Case> { StatusCode = HttpStatusCode.OK, ResponseContent = entity }); // Act var result = await _caseService.GetCase(""); // Assert Assert.True(result.TypesOfFostering.Exists(_ => _.Equals("childrenWithDisability"))); Assert.True(result.TypesOfFostering.Exists(_ => _.Equals("respite"))); Assert.True(result.TypesOfFostering.Exists(_ => _.Equals("shortTerm"))); Assert.True(result.TypesOfFostering.Exists(_ => _.Equals("longTerm"))); Assert.True(result.TypesOfFostering.Exists(_ => _.Equals("unsure"))); Assert.True(result.TypesOfFostering.Exists(_ => _.Equals("shortBreaks"))); }
public void CaseDefault_AlreadyExists_ThrowsException() { CaseBuilder cb = Channel.CaseRead <int>(Channel.CreateUnbounded <int>(), i => { }).CaseDefault(() => { }); Assert.Throws <InvalidOperationException>(() => cb.CaseDefault(() => { })); Assert.Throws <InvalidOperationException>(() => cb.CaseDefault(() => Task.CompletedTask)); }
public async Task GetCase_ShouldReturn_FosteringCase() { // Arrange var entity = new CaseBuilder() .WithIntegrationFormField("religionorfaithgroup", "Religion") .WithIntegrationFormField("gender", "Gender") .WithIntegrationFormField("ethnicity", "Ethnicity") .WithIntegrationFormField("nationality", "Nationality") .WithIntegrationFormField("previousname", "Previous name") .WithIntegrationFormField("surname", "Last Name") .WithIntegrationFormField("firstname", "First Name") .Build(); _verintServiceGatewayMock .Setup(_ => _.GetCase(It.IsAny <string>())) .ReturnsAsync(new HttpResponse <Case> { StatusCode = HttpStatusCode.OK, ResponseContent = entity }); // Act var result = await _caseService.GetCase("1234"); // Assert Assert.IsType <FosteringCase>(result); }
private void ClearSelectedCase() { if (IsStandart) { StandartCase newCase; newCase = new CaseBuilder().CreateStandartCase(BPId); graphControl1.Graph = null; graphControl1.Graph = Graph_Setup(newCase); } foreach (var n in graphControl1.Graph.Nodes) { n.Attr.Color = Color.Black; n.Attr.LineWidth = 1; //n.Attr.Color = new Color(byte.MaxValue / 2, n.Attr.Color.R, n.Attr.Color.G, n.Attr.Color.B); } foreach (var e in graphControl1.Graph.Edges) { e.Attr.Color = Color.Black; e.TargetNode.Attr.LineWidth = 1; e.Attr.LineWidth = 1; //e.Attr.Color = new Color(byte.MaxValue / 2, e.Attr.Color.R, e.Attr.Color.G, e.Attr.Color.B); } }
public void MapToReferenceDetails_ShouldReturnCompleteReferenceDetails() { //Arrange var entity = new CaseBuilder() .WithIntegrationFormField("prfpostcode", "SK1 3XE") .WithIntegrationFormField("prfaddress", "Address line 1|Address line 2|Town") .WithIntegrationFormField("prfplaceref", "1234") .WithIntegrationFormField("prffirstname", "name") .WithIntegrationFormField("prflastname", "lastname") .WithIntegrationFormField("prfrelation", "relation") .WithIntegrationFormField("prfyears", "years") .WithIntegrationFormField("prfemail", "email") .WithIntegrationFormField("prfcontact", "contact") .Build(); //Act var result = ReferenceDetailsMapper.MapToReferenceDetails(entity.IntegrationFormFields, "prffirstname", "prflastname", "prfrelation", "prfyears", "prfemail", "prfcontact", "prfaddress", "prfplaceref", "prfpostcode"); //Assert Assert.Equal(string.Empty, result.Address.AddressLine1); Assert.Equal(string.Empty, result.Address.AddressLine2); Assert.Equal(string.Empty, result.Address.Town); Assert.Equal("SK1 3XE", result.Address.Postcode); Assert.Equal("1234", result.Address.PlaceRef); Assert.Equal("name", result.FirstName); Assert.Equal("lastname", result.LastName); Assert.Equal("relation", result.RelationshipToYou); Assert.Equal("years", result.NumberOfYearsKnown); Assert.Equal("email", result.EmailAddress); Assert.Equal("contact", result.PhoneNumber); }
public async Task GetCase_ShoulSetIsApplicationCompleted(string enquiryType, bool isApplicationCompleted) { var entity = new CaseBuilder() .WithIntegrationFormField("religionorfaithgroup", "Religion") .WithIntegrationFormField("gender", "Gender") .WithIntegrationFormField("ethnicity", "Ethnicity") .WithIntegrationFormField("nationality", "Nationality") .WithIntegrationFormField("previousname", "Previous name") .WithIntegrationFormField("surname", "Last Name") .WithIntegrationFormField("firstname", "First Name") .WithEnquiryType(enquiryType) .Build(); _verintServiceGatewayMock .Setup(_ => _.GetCase(It.IsAny <string>())) .ReturnsAsync(new HttpResponse <Case> { StatusCode = HttpStatusCode.OK, ResponseContent = entity }); // Act var result = await _caseService.GetCase("1234"); Assert.Equal(isApplicationCompleted, result.IsApplicationCompleted); }
public async Task GetCase_ShouldSetEnableAdditionalInformationToTrueWhenDefinitionNameIsSetToFosteringApplication() { var entity = new CaseBuilder() .WithIntegrationFormField("firstname", "First name") .WithIntegrationFormField("surname", "Surname") .WithEnquirySubject("Fostering") .WithEnquiryReason("Fostering Application") .WithEnquiryType("3. Application") .Build(); //Arrange _verintServiceGatewayMock.Setup(_ => _.GetCase(It.IsAny <string>())) .ReturnsAsync(new HttpResponse <Case> { StatusCode = HttpStatusCode.OK, ResponseContent = entity }); //Act var result = await _caseService.GetCase("123"); //Assert Assert.True(result.EnableAdditionalInformationSection); }
public async Task GetCase_ShouldMapGpDetails() { // Arrange var entity = new CaseBuilder() .WithIntegrationFormField("surname", "Last Name") .WithIntegrationFormField("firstname", "First Name") .WithIntegrationFormField("nameofgp", "Name of gp") .WithIntegrationFormField("nameofpractice", "Name of practice") .WithIntegrationFormField("gpphonenumber", "01234567890") .WithIntegrationFormField("addressofpractice", "First Line 1|Second Line 2|Town") .WithIntegrationFormField("postcodeofpractice", "SK1 3XE") .WithIntegrationFormField("placerefofpractice", "12345") .Build(); _verintServiceGatewayMock .Setup(_ => _.GetCase(It.IsAny <string>())) .ReturnsAsync(new HttpResponse <Case> { StatusCode = HttpStatusCode.OK, ResponseContent = entity }); // Act var result = await _caseService.GetCase("1234"); // Assert Assert.Equal("Name of gp", result.FirstApplicant.NameOfGp); Assert.Equal("Name of practice", result.FirstApplicant.NameOfGpPractice); Assert.Equal("01234567890", result.FirstApplicant.GpPhoneNumber); Assert.Equal("", result.FirstApplicant.GpAddress.AddressLine1); Assert.Equal("", result.FirstApplicant.GpAddress.AddressLine2); Assert.Equal("", result.FirstApplicant.GpAddress.Town); Assert.Equal("12345", result.FirstApplicant.GpAddress.PlaceRef); Assert.Equal("SK1 3XE", result.FirstApplicant.GpAddress.Postcode); }
public void GivenCase_WhenBuild_ThenPreviousObjectStateIsNull() { var complaint = new CaseBuilder(this.DatabaseSession).WithDescription("Complaint").Build(); this.DatabaseSession.Derive(true); Assert.IsNull(complaint.PreviousObjectState); }
public void CaseRead_Async_InvalidArguments_ThrowsArgumentException() { CaseBuilder cb = Channel.CaseRead <int>(Channel.CreateUnbounded <int>(), i => { }); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseRead <int>(null, (Func <int, Task>)null)); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseRead <int>(null, i => Task.CompletedTask)); Assert.Throws <ArgumentNullException>("func", () => cb.CaseRead <int>(Channel.CreateUnbounded <int>(), (Func <int, Task>)null)); }
public void CaseWrite_Async_InvalidArguments_ThrowsArgumentException() { CaseBuilder cb = Channel.CaseRead <int>(Channel.CreateUnbounded <int>(), i => { }); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseWrite <int>(null, 0, (Func <Task>)null)); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseWrite <int>(null, 0, delegate { return(Task.CompletedTask); })); Assert.Throws <ArgumentNullException>("func", () => cb.CaseWrite <int>(Channel.CreateUnbounded <int>(), 0, (Func <Task>)null)); }
public void CaseWrite_Sync_InvalidArguments_ThrowsArgumentException() { CaseBuilder cb = Channel.CaseRead <int>(Channel.CreateUnbounded <int>(), i => { }); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseWrite <int>(null, 0, (Action)null)); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseWrite <int>(null, 0, (Action) delegate { })); Assert.Throws <ArgumentNullException>("action", () => cb.CaseWrite <int>(Channel.CreateUnbounded <int>(), 0, (Action)null)); }
public void GivenCase_WhenBuild_ThenPreviousObjectStateIsNull() { var complaint = new CaseBuilder(this.Session).WithDescription("Complaint").Build(); this.Session.Derive(); Assert.Null(complaint.PreviousCaseState); }
public void CreateAddressHistoryList_ShouldMapMultipleAddressWhenFieldsAreNotNull() { // Arrange var address1Line1 = "add1-line1"; var address1Line2 = "add1-line2"; var address1LineTown = "add1-town"; var address1LineCounty = "add1-county"; var address1LineCountry = "add1-country"; var address1LinePostcode = "add1-postcode"; var year1 = "2015"; var month1 = "08"; var address2Line1 = "add2-line1"; var address2Line2 = "add2-line2"; var address2LineTown = "add2-town"; var address2LineCounty = "add2-county"; var address2LineCountry = "add2-country"; var address2LinePostcode = "add2-pstcode"; var year2 = "2010"; var month2 = "01"; var date1 = new DateTime(int.Parse(year1), int.Parse(month1), 01); var date2 = new DateTime(int.Parse(year2), int.Parse(month2), 01); var builder = new CaseBuilder() .WithIntegrationFormField("pa1applicant1", $"{address1Line1}|{address1Line2}|{address1LineTown}|{address1LineCounty}|{address1LineCountry}") .WithIntegrationFormField("pa1postcodeapplicant1", address1LinePostcode) .WithIntegrationFormField("pa1datefrommonthapplicant1", month1) .WithIntegrationFormField("pa1datefromyearapplicant1", year1) .WithIntegrationFormField("pa2applicant1", $"{address2Line1}|{address2Line2}|{address2LineTown}|{address2LineCounty}|{address2LineCountry}") .WithIntegrationFormField("pa2postcodeapplicant1", address2LinePostcode) .WithIntegrationFormField("pa2datefrommonthapplicant1", month2) .WithIntegrationFormField("pa2datefromyearapplicant1", year2) .Build(); // Act var result = _helper.CreateAddressHistoryList(builder.IntegrationFormFields); // Assert Assert.Equal(3, result.Count); Assert.Equal(address1Line1, result[1].Address.AddressLine1); Assert.Equal(address1Line2, result[1].Address.AddressLine2); Assert.Equal(address1LineTown, result[1].Address.Town); Assert.Equal(address1LineCounty, result[1].Address.County); Assert.Equal(address1LineCountry, result[1].Address.Country); Assert.Equal(address1LinePostcode, result[1].Address.Postcode); Assert.Equal(address1LinePostcode, result[1].Address.Postcode); Assert.Equal(date1, result[1].DateFrom); Assert.Equal(address2Line1, result[2].Address.AddressLine1); Assert.Equal(address2Line2, result[2].Address.AddressLine2); Assert.Equal(address2LineTown, result[2].Address.Town); Assert.Equal(address2LineCounty, result[2].Address.County); Assert.Equal(address2LineCountry, result[2].Address.Country); Assert.Equal(address2LinePostcode, result[2].Address.Postcode); Assert.Equal(address2LinePostcode, result[2].Address.Postcode); Assert.Equal(date2, result[2].DateFrom); }
public void GivenCase_WhenBuild_ThenLastObjectStateEqualsCurrencObjectState() { var complaint = new CaseBuilder(this.DatabaseSession).WithDescription("Complaint").Build(); this.DatabaseSession.Derive(true); Assert.AreEqual(new CaseObjectStates(this.DatabaseSession).Opened, complaint.CurrentObjectState); Assert.AreEqual(complaint.LastObjectState, complaint.CurrentObjectState); }
public void GivenCase_WhenBuild_ThenLastObjectStateEqualsCurrencObjectState() { var complaint = new CaseBuilder(this.Session).WithDescription("Complaint").Build(); this.Session.Derive(); Assert.Equal(new CaseStates(this.Session).Opened, complaint.CaseState); Assert.Equal(complaint.LastCaseState, complaint.CaseState); }
private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (dataGrid.SelectedItem != null) { Case newCase; if (Stage == 1) { //visualize case var selectedRow = dataGrid.SelectedItem as Controller.BPCasedto; var CaseId = selectedRow.НомерСлучая; if (CaseId == -1) { if (IsStandart) { var @case = new CaseBuilder().CreateStandartCase(BPId); graphControl1.Graph = null; graphControl1.Graph = Graph_Setup(@case); } else { newCase = new CaseBuilder().CreateGeneralCase(); graphControl1.Graph = null; graphControl1.Graph = Graph_Setup(newCase); } } else { newCase = new CaseBuilder().CreateCase(CaseId); SelectCase(newCase); } statusCurrent.Text = $"Текущий случай: {selectedRow.НомерСлучая}"; } else { //build general case var selectedBP = dataGrid.SelectedItem as BPdto; if (selectedBP != null) { BPId = selectedBP.Номер; var BPname = BPsControl.GetBPbyName(selectedBP.Название); BPName = BPname; BPLabel.Content = $"Модель бизнес-процесса: {BPname}"; newCase = new CaseBuilder().CreateGeneralCase(); graphControl1.Graph = null; graphControl1.Graph = Graph_Setup(newCase); statusCurrent.Text = $"Текущий БП: {selectedBP.Номер}"; } } } }
public void CaseReadWrite_Async_CallMultipleTimes_IdempotentResult() { CaseBuilder builder1 = Channel.CaseRead <int>(Channel.CreateUnbounded <int>(), i => Task.CompletedTask); Assert.Same(builder1, builder1.CaseRead <int>(Channel.CreateUnbounded <int>(), i => Task.CompletedTask)); Assert.Same(builder1, builder1.CaseWrite(Channel.CreateUnbounded <string>(), "", () => Task.CompletedTask)); Assert.Same(builder1, builder1.CaseDefault(() => Task.CompletedTask)); CaseBuilder builder2 = Channel.CaseWrite(Channel.CreateUnbounded <int>(), 0, () => Task.CompletedTask); Assert.Same(builder2, builder2.CaseRead <int>(Channel.CreateUnbounded <int>(), i => Task.CompletedTask)); Assert.Same(builder2, builder2.CaseWrite(Channel.CreateUnbounded <string>(), "", () => Task.CompletedTask)); Assert.Same(builder2, builder2.CaseDefault(() => Task.CompletedTask)); }
public void GivenCase_WhenConfirmed_ThenCurrentCaseStatusMustBeDerived() { var complaint = new CaseBuilder(this.Session).WithDescription("Complaint").Build(); this.Session.Derive(); Assert.Equal(1, complaint.AllVersions.Count); Assert.Equal(new CaseStates(this.Session).Opened, complaint.CaseState); complaint.AppsClose(); this.Session.Derive(); Assert.Equal(2, complaint.AllVersions.Count); Assert.Equal(new CaseStates(this.Session).Closed, complaint.CaseState); }
public void GivenCase_WhenConfirmed_ThenCurrentCaseStatusMustBeDerived() { var complaint = new CaseBuilder(this.DatabaseSession).WithDescription("Complaint").Build(); this.DatabaseSession.Derive(true); Assert.AreEqual(1, complaint.CaseStatuses.Count); Assert.AreEqual(new CaseObjectStates(this.DatabaseSession).Opened, complaint.CurrentCaseStatus.CaseObjectState); complaint.AppsClose(); this.DatabaseSession.Derive(true); Assert.AreEqual(2, complaint.CaseStatuses.Count); Assert.AreEqual(new CaseObjectStates(this.DatabaseSession).Closed, complaint.CurrentCaseStatus.CaseObjectState); }
public async Task GetCase_ShouldMapSecondApplicant_ToFosteringCase() { // Arrange var entity = new CaseBuilder() .WithIntegrationFormField("religionorfaithgroup", "Religion") .WithIntegrationFormField("gender", "Gender") .WithIntegrationFormField("ethnicity", "Ethnicity") .WithIntegrationFormField("nationality", "Nationality") .WithIntegrationFormField("previousname", "Previous name") .WithIntegrationFormField("surname", "Last Name") .WithIntegrationFormField("firstname", "First Name") .WithIntegrationFormField("withpartner", "Yes") .WithIntegrationFormField("firstname_2", "First Name") .WithIntegrationFormField("surname_2", "Last Name") .WithIntegrationFormField("previousname_2", "Previous name") .WithIntegrationFormField("nationality2", "Nationality") .WithIntegrationFormField("ethnicity2", "Ethnicity") .WithIntegrationFormField("gender2", "Gender") .WithIntegrationFormField("religionorfaithgroup2", "Religion") .WithIntegrationFormField("hasanothername2", "True") .WithIntegrationFormField("haschildrenundersixteen2", "yes") .WithIntegrationFormField("haschildrenoversixteen2", "yes") .Build(); _verintServiceGatewayMock .Setup(_ => _.GetCase(It.IsAny <string>())) .ReturnsAsync(new HttpResponse <Case> { StatusCode = HttpStatusCode.OK, ResponseContent = entity }); // Act var result = await _caseService.GetCase("1234"); // Assert Assert.NotNull(result.FirstApplicant); Assert.NotNull(result.SecondApplicant); Assert.Equal("First Name", result.SecondApplicant.FirstName); Assert.Equal("Last Name", result.SecondApplicant.LastName); Assert.True(result.SecondApplicant.EverBeenKnownByAnotherName); Assert.Equal("Previous name", result.SecondApplicant.AnotherName); Assert.Equal("Nationality", result.SecondApplicant.Nationality); Assert.Equal("Ethnicity", result.SecondApplicant.Ethnicity); Assert.Equal("Gender", result.SecondApplicant.Gender); Assert.Equal("Religion", result.SecondApplicant.Religion); }
public void CreateAddressHistoryList_ShouldCurrentAddress_AsFirstItem() { // Arrange var date = new DateTime(int.Parse("2018"), int.Parse("8"), 01); var builder = new CaseBuilder() .WithIntegrationFormField("currentdatefrommonthapplicant1", "08") .WithIntegrationFormField("currentdatefromyearapplicant1", "2018") .Build(); // Act var result = _helper.CreateAddressHistoryList(builder.IntegrationFormFields); // Assert Assert.Single(result); Assert.Equal(date, result[0].DateFrom); }
public void MapToFosteringAddress_ShouldReturnAddressWithLine1() { //Arrange var entity = new CaseBuilder() .WithIntegrationFormField("postcode", "SK1 3XE") .WithIntegrationFormField("address", "Address line 1||") .WithIntegrationFormField("placeref", "") .Build(); //Act var result = AddressMapper.MapToFosteringAddress(entity.IntegrationFormFields, "address", "placeref", "postcode"); //Assert Assert.Equal("Address line 1", result.AddressLine1); Assert.Equal(string.Empty, result.AddressLine2); Assert.Equal(string.Empty, result.Town); Assert.Equal("SK1 3XE", result.Postcode); Assert.Equal(string.Empty, result.PlaceRef); }
public async Task GetCase_ShouldMapStatus(string status, ETaskStatus expectedStatus) { // Arrange var entity = new CaseBuilder() .WithIntegrationFormField("surname", "Last Name") .WithIntegrationFormField("firstname", "First Name") .WithIntegrationFormField("tellusaboutyourselfstatus", status) .Build(); _verintServiceGatewayMock .Setup(_ => _.GetCase(It.IsAny <string>())) .ReturnsAsync(new HttpResponse <Case> { StatusCode = HttpStatusCode.OK, ResponseContent = entity }); // Act var result = await _caseService.GetCase(""); // Assert Assert.Equal(expectedStatus, result.Statuses.TellUsAboutYourselfStatus); }
public async Task GetCase_ShouldMapReasonsForFostering() { // Arrange var entity = new CaseBuilder() .WithIntegrationFormField("surname", "Last Name") .WithIntegrationFormField("firstname", "First Name") .WithIntegrationFormField("reasonsforfosteringapplicant1", "test") .Build(); _verintServiceGatewayMock .Setup(_ => _.GetCase(It.IsAny <string>())) .ReturnsAsync(new HttpResponse <Case> { StatusCode = HttpStatusCode.OK, ResponseContent = entity }); // Act var result = await _caseService.GetCase(""); // Assert Assert.Equal("test", result.ReasonsForFostering); }
private void viewStandart_Click(object sender, RoutedEventArgs e) { if (viewStandart.IsChecked == true) { IsStandart = true; StandartCase newCase; newCase = new CaseBuilder().CreateStandartCase(BPId); graphControl1.Graph = null; graphControl1.Graph = Graph_Setup(newCase); BPLabel.Content = $"Эталонная модель бизнес-процесса: {BPName}"; } else { IsStandart = false; Case newCase; newCase = new CaseBuilder().CreateGeneralCase(); graphControl1.Graph = null; graphControl1.Graph = Graph_Setup(newCase); BPLabel.Content = $"Модель бизнес-процесса: {BPName}"; } }
public static string Case(this IQueryWithParams query, Action<CaseBuilder> builder) { var cb = new CaseBuilder(); builder(cb); return cb.ToString(query); }
public void SelectUntilAsync_InvalidArguments_ThrowsExceptions() { CaseBuilder cb = Channel.CaseRead <int>(Channel.CreateUnbounded <int>(), i => { }); Assert.Throws <ArgumentNullException>(() => { cb.SelectUntilAsync(null); }); }