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 async Task AndTheSurveyIsValidWithMaximumBoundaryConditionsThenTheResponseHasAStatusCodeOfOk() { // Arrange var survey = new SurveyBuilder() .WithMaximumBoundaryValidValues() .Build(); // Act var response = await PostSurvey(survey); // Assert response.StatusCode.Should().Be(HttpStatusCode.OK); }
protected override void SetPageSessionContext() { base.SetPageSessionContext(); var settings = new NameValueCollection(); settings.Add("ECNEngineAccessKey", Guid.NewGuid().ToString()); ShimConfigurationManager.AppSettingsGet = () => settings; _testEntity = new SurveyBuilder(); _privateObject = new PrivateObject(_testEntity); InitializeAllControls(_testEntity); InitializeSessionFakes(); QueryString.Clear(); }
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); }
public static void Get_1Page_3Checkbox(SurveyBuilder <CompanyDto> builder, string pageName) { builder.AddPage(pageName, page => page.AddCheckboxInput(x => x.ContactData, b => b .HasTitle("Choice 1 Title (asc) - All - None") .AddChoice("CB1Val1", "Choice 1") .AddChoice("CB1Val2", "Choice 2") .AddChoice("CB1Val3", "Choice 3") .AddChoice("CB1Val4", "Choice 4") .AddChoice("CB1Val5", "Choice 5") .HasColumnCount(1) .HasOtherChoice("Other choice text") .HasSelectAllChoice("Select All") .HasSelectNoneChoice("Select none") .SetChoicesOrder(SurveyChoicesOrderEnum.asc)) .AddCheckboxInput(x => x.ContactData, b => b .HasTitle("Choice 2 Title (desc) - All") .AddChoice("CB2Val1", "Choice 1") .AddChoice("CB2Val2", "Choice 2") .AddChoice("CB2Val3", "Choice 3") .AddChoice("CB2Val4", "Choice 4") .AddChoice("CB2Val5", "Choice 5") .HasColumnCount(2) .HasOtherChoice("Other choice text") .HasSelectAllChoice("Select All") .SetChoicesOrder(SurveyChoicesOrderEnum.desc)) .AddCheckboxInput(x => x.ContactData, b => b .HasTitle("Choice 3 Title (random) - None") .AddChoice("CB3Val1", "Choice 1") .AddChoice("CB3Val2", "Choice 2") .AddChoice("CB3Val3", "Choice 3") .AddChoice("CB3Val4", "Choice 4") .AddChoice("CB3Val5", "Choice 5") .HasColumnCount(3) .HasOtherChoice("Other choice text") .HasSelectNoneChoice("Select none") .SetChoicesOrder(SurveyChoicesOrderEnum.random)) ); }
public static void Get_1Page_3Radiogroup(SurveyBuilder <CompanyDto> builder, string pageName) { builder.AddPage(pageName, page => page.AddRadiogroupInput(x => x.ContactData, b => b .HasTitle("Radiogroup 1 Title (asc)") .AddChoice("RG1Val1", "Choice 1") .AddChoice("RG1Val2", "Choice 2") .AddChoice("RG1Val3", "Choice 3") .AddChoice("RG1Val4", "Choice 4") .AddChoice("RG1Val5", "Choice 5") .HasColumnCount(1) .HasOtherChoice("Other choice text") .SetChoicesOrder(SurveyChoicesOrderEnum.asc)) .AddRadiogroupInput(x => x.ContactData, b => b .HasTitle("Radiogroup 2 Title (desc)") .AddChoice("RG2Val1", "Choice 1") .AddChoice("RG2Val2", "Choice 2") .AddChoice("RG2Val3", "Choice 3") .AddChoice("RG2Val4", "Choice 4") .AddChoice("RG2Val5", "Choice 5") .HasColumnCount(2)) .AddRadiogroupInput(x => x.ContactData, b => b .HasTitle("Radiogroup 3 Title (random)") .AddChoice("RG3Val1", "Choice 1") .AddChoice("RG3Val2", "Choice 2") .AddChoice("RG3Val3", "Choice 3") .AddChoice("RG3Val4", "Choice 4") .AddChoice("RG3Val5", "Choice 5") .HasColumnCount(3) .SetChoicesOrder(SurveyChoicesOrderEnum.random)) ); }
public static HtmlString GetSurvey(this IHtmlHelper helper, SurveyViewModel model) { var html = SurveyBuilder.GetInstance(model).GetHTML(); return(new HtmlString(html)); }