Beispiel #1
0
        /// <summary> Test a correct decoding </summary>
        public void TestDecode()
        {
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(requestText));
            HttpForm     form   = _decoder.Decode(stream, "multipart/form-data; boundary=---------------------------18506757825014", Encoding.UTF8);

            Assert.True(form["HiddenField"].Contains("buttomAss"));
            Assert.True(form["HiddenField"].Contains("monkeyAss"));
            Assert.Equal("Hejsan", form["HiddenField"]["monkeyAss"].Value);
            Assert.Equal("Tjosan", form["HiddenField"]["buttomAss"].Value);
            Assert.NotNull(form.GetFile("VCardFile"));
            Assert.False(string.IsNullOrEmpty(form.GetFile("VCardFile").Filename));
            Assert.True(File.Exists(form.GetFile("VCardFile").Filename));
            form.GetFile("VCardFile").Dispose();

            stream.Dispose();
        }
 public void TestArgumentNullGetFile()
 {
     Assert.Throws(typeof(ArgumentNullException), delegate
                   { _form.GetFile(string.Empty); });
 }