public void TestSingleInput() { SurveyBuilder <CompanyDto> companyBuilder = new SurveyBuilder <CompanyDto>(); companyBuilder.AddPage("Pagina 1", page => page.AddSingleInput(x => x.DocumentId, b => b .HasTitle("Dni") .HasPlaceHolder("Ponga aqui su dni") .SetInputType(SurveyInputType.Text)) .AddSingleInput(x => x.ContactData, b => b .HasTitle("Datos de Contacto") .HasPlaceHolder("Ponga Aqui sus Datos de Contacto")) ) .AddPage("Pagina 2", page => page.AddSingleInput(x => x.IsCashReceiptCriteria, b => b.SetInputType(SurveyInputType.Email)) ); companyBuilder.AddPage("MiPaginaMolona", p => p.AddSingleInput(c => c.DocumentId, "placeholderMolon", "MiDni", SurveyInputType.Text)); var myBuildedElements = companyBuilder.Build(); myBuildedElements.Pages.Count.Should().Be(3); }
public void TestBuilders() { SurveyBuilder <CompanyDto> companyBuilder = new SurveyBuilder <CompanyDto>(); Factory.BulderFactory.Get_1Page_3Checkbox(companyBuilder, "Checkbox Page"); Factory.BulderFactory.Get_1Page_3Radiogroup(companyBuilder, "Radiogroup Page"); var myBuildedElements = companyBuilder.Build(); myBuildedElements.Pages.Count.Should().Be(2); }
public void TestSerialization() { SurveyBuilder <CompanyDto> companyBuilder = new SurveyBuilder <CompanyDto>(); companyBuilder.AddPage("Page1", p => p.AddSingleInput(c => c.DocumentId, "Put Here your DNI", "Document Id Card", SurveyInputType.Text)); Factory.BulderFactory.Get_1Page_3Checkbox(companyBuilder, "Checkbox Page"); Factory.BulderFactory.Get_1Page_3Radiogroup(companyBuilder, "Radiogroup Page"); var myBuildedElements = companyBuilder.Build(); var jsonextracted = JsonConvert.SerializeObject(myBuildedElements, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }); jsonextracted.Should().Be(jsoncollections.test1); }
public void Should_ReturnSurvey_When_BuildFromADto() { var dto = new SurveyDto { Elevator = "A", Shift = "V", Floor = "11" }; var builder = new SurveyBuilder(); var survey = builder.Build(dto); Assert.IsTrue(survey.Floor == 11); Assert.IsTrue(survey.Shift == Shift.V); Assert.IsTrue(survey.Elevator == Elevator.A); }