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); } }
public void GoToStaticWithStatusNavigatesToPageLocationTest() { var expected = new TextPageWrapper(); var target = Substitute.For <IBrowser>(); target.Execute <TextPageWrapper>( Arg.Is <HttpRequestMessage>(x => x.RequestUri == expected.TargetLocation && x.Method == HttpMethod.Get), HttpStatusCode.NotFound, Arg.Any <IPageFactory>()).Returns(expected); var actual = target.GoTo <TextPageWrapper>(HttpStatusCode.NotFound); actual.Should().BeSameAs(expected); }
public void GoToStaticWithStatusNavigatesToPageLocationTest() { var expected = new TextPageWrapper(); var target = Substitute.For<IBrowser>(); target.Execute<TextPageWrapper>( Arg.Is<HttpRequestMessage>(x => x.RequestUri == expected.TargetLocation && x.Method == HttpMethod.Get), HttpStatusCode.NotFound, Arg.Any<IPageFactory>()).Returns(expected); var actual = target.GoTo<TextPageWrapper>(HttpStatusCode.NotFound); actual.Should().BeSameAs(expected); }
public void GoToStaticLocationNavigatesToSpecificLocationTest() { var location = new Uri("http://www.somwhere.com"); var expected = new TextPageWrapper(); var target = Substitute.For <IBrowser>(); target.Execute <TextPageWrapper>( Arg.Is <HttpRequestMessage>(x => x.RequestUri == location && x.Method == HttpMethod.Get), HttpStatusCode.OK, Arg.Any <IPageFactory>()).Returns(expected); var actual = target.GoTo <TextPageWrapper>(location); actual.Should().BeSameAs(expected); }
public void GoToStaticLocationNavigatesToSpecificLocationTest() { var location = new Uri("http://www.somwhere.com"); var expected = new TextPageWrapper(); var target = Substitute.For<IBrowser>(); target.Execute<TextPageWrapper>( Arg.Is<HttpRequestMessage>(x => x.RequestUri == location && x.Method == HttpMethod.Get), HttpStatusCode.OK, Arg.Any<IPageFactory>()).Returns(expected); var actual = target.GoTo<TextPageWrapper>(location); actual.Should().BeSameAs(expected); }
public void PostToStaticNavigatesToPageLocationTest() { IList <PostEntry> parameters = new List <PostEntry> { new PostEntry("test", "value") }; 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); }
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); } }
public void PostToStaticNavigatesToPageLocationTest() { IList<PostEntry> parameters = new List<PostEntry> { new PostEntry("test", "value") }; 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); }