Example #1
0
        public async Task Uploading_A_File_With_Enctype_MultipartMime()
        {
            Browser b = new Browser(Helper.GetAllways200RequestMocker());

            b.SetContent(Helper.GetFromResources("SimpleBrowser.UnitTests.SampleDocs.FileUpload.htm"));

            HttpRequestLog lastLog = null;

            b.RequestLogged += (br, l) =>
            {
                lastLog = l;
            };

            HtmlResult    form = b.Select("form");
            HtmlResult    file = b.Select("input[name=theFile]");
            DirectoryInfo dir  = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);

            file.Value = dir.GetFiles()[3].FullName;
            await form.SubmitFormAsync();

            Assert.NotNull(lastLog);
            Assert.That(lastLog.Method == "POST");
        }