public void PostToStaticWithFileEntriesNavigatesToPageLocationTest()
{
var tempFile = Path.GetTempFileName();
try
{
File.WriteAllText(tempFile, Guid.NewGuid().ToString());
IList<PostEntry> parameters = new List<PostEntry>
{
new PostEntry("test", "value"),
new PostFileEntry("files", tempFile),
new PostFileStreamEntry("files", "dynamicFile.txt", new MemoryStream()),
new PostFileEntry("files", null)
};
var expected = new TextPageWrapper();
var target = Substitute.For<IBrowser>();
target.Execute<TextPageWrapper>(
Arg.Is<HttpRequestMessage>(x => x.RequestUri == expected.TargetLocation && x.Method == HttpMethod.Post),
HttpStatusCode.OK,
Arg.Any<IPageFactory>()).Returns(expected);
var actual = target.PostTo<TextPageWrapper>(parameters);
actual.Should().BeSameAs(expected);
}
finally
{
File.Delete(tempFile);
}
}