i-e-b / Huygens

Cut down Cassini server for internally hosting IIS sites
Other
3 stars 1 forks source link

test Web Forms #3

Closed Pavel-Teplitsky closed 5 years ago

Pavel-Teplitsky commented 5 years ago

Hi, is it possible to test Web Froms project with this library? For example test status code http://prntscr.com/ltk2cc , I have tried but unfortunatly looks like it doesn't http://prntscr.com/ltk2rp

i-e-b commented 5 years ago

Yes, WebForms site are supported. It might be useful to look at the status message and body coming back from your failure. Please note that Huygen needs to run against a built, published site (the same as you would deploy to IIS) That generally means pointing it at a directory that has web.config and bin directory.

The standard build output of Visual Studio will result in something like bin/Debug/MySite.dll. You may need to change this to output bin/MySite.dll (i.e. no Debug or Release folder).

Pavel-Teplitsky commented 5 years ago

Hi, the data values returned from the server.DirectCall(request) you can see on this screenshot: http://prntscr.com/ltwax6 As for the build output all files placed in the bin folder http://prntscr.com/ltwbpt Also the phisical path is valid http://prntscr.com/ltwbyq btw if you need I can share the sources.

i-e-b commented 5 years ago

If you can share the sources I can take a look.

Pavel-Teplitsky commented 5 years ago

please download this branch https://github.com/groupdocs-total/GroupDocs.Total-for-NET-WebForms/tree/basic-integration-tests

i-e-b commented 5 years ago

I'll try to take a look at that soon. At a quick glance, you might want to look at the relative path you are using.

i-e-b commented 5 years ago

OK -- the path was the original issue, but you have another one. Your project is using OWIN, which Huygens doesn't support -- it's technically not running under an IIS application (it's running under Kestrel server with a proxy)

OWIN does have its own self-host and test tooling which you can use in this case.

For future reference, this is the test that ran for me:

        [Test]
        public void ViewStatusTest()
        {
            string path =  @"C:\Temp\extTest\src";
            using (var server = new DirectServer(path))
            {
                var request = new SerialisableRequest
                {
                    Method = "GET",
                    RequestUri = "/viewer",
                    Content = null
                };

                var result = server.DirectCall(request);
                Console.WriteLine(Encoding.UTF8.GetString(result.Content));

                Assert.That(result.StatusCode, Is.EqualTo(200));
            }
        }