public void ArrayForm() { using (var form = new MultipartFormDataContent()) { FormContentBuilder.BuildFormContent(new ArrayQueryTest() { Name = "Bob", Numbers = new int[] { 1, 15, 20 } }, form); Assert.Equal(2, form.Count()); } }
public void BasicForm() { using (var form = new MultipartFormDataContent()) { FormContentBuilder.BuildFormContent(new SimpleQueryTest() { Name = "Bob", Number = 1 }, form); Assert.Equal(2, form.Count()); } }
public void EncodedForm() { using (var form = new MultipartFormDataContent()) { FormContentBuilder.BuildFormContent(new SimpleQueryTest() { Name = "Bob Smith & The Crew / Other Peeps", Number = 1 }, form); Assert.Equal(2, form.Count()); } }
public void DictionaryForm() { using (var form = new MultipartFormDataContent()) { FormContentBuilder.BuildFormContent(new Dictionary <String, Object>() { { "Name", "Bob" }, { "Numbers", new List <int>() { 1, 15, 20 } } }, form); Assert.Equal(2, form.Count()); } }
public void StreamForm() { using (var form = new MultipartFormDataContent()) { using (var streamWriter = new StreamWriter(new MemoryStream())) { streamWriter.WriteLine("This is a test of a stream"); FormContentBuilder.BuildFormContent(new FileTest() { Name = "Bob", Stream = streamWriter.BaseStream }, form); } Assert.Equal(2, form.Count()); } }