Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Use MvcTextFixture as much as possible #3133

Closed
wants to merge 4 commits into from
Closed

Conversation

dougbu
Copy link
Contributor

@dougbu dougbu commented Sep 15, 2015

  • Frequent IOExceptions using MVC with Core CLR on Linux #3066
    • reduce TestServer -> PhysicalFileProvider -> FileSystemWatcher count enough to run with Core CLR on Linux
  • remove use of HttpClient.DefaultRequestHeaders; any client change affects other tests
  • remove use of RequestBuilder class; creates a per-test HttpClient and requires the TestServer
  • updated a few expectations because CommonTestEncoder does JavaScript a bit differently
    • "JavaScriptEncode[[...]]" -> "JavaScriptStringEncode[[...]]"
  • side benefit: xUnit reports functional tests execute for only ~12.4s; was >30s before this change

nits:

  • touched-up some leftover _app &c declarations to be more explicit and minimize usings
  • moved statements into correct sections of methods in RoutingTests
  • removed TestLoggerFactory and related classes from TagHelperSampleTest

- handle `ConfigureServices()` methods that are not `void`
- ensure server is initialized with consistent `CurrentCulture` and `CurrentUICulture`
- add `FilteredDefaultAssemblyProviderFixture<TStartup>` and `MvcEncodedTestFixture<TStartup>`
  - add `MvcTextFixture.AddAdditionalServices()` extension point supporting these

- do not expose the `TestServer`; an anti-pattern for tests to manipulate the server
- update class names to match containing files
- use existing `TestApplicationEnvironment`
  - apply some `MvcTestFixture` improvements to the shared `TestApplicationEnvironment` class
- change `ConfigureServices()` support to use the same approach
- remove use of `HttpClient.DefaultRequestHeaders`; any client change affects other tests
- remove use of `RequestBuilder` class; creates a per-test `HttpClient` and access requires the `TestServer`
- updated a few expectations because `CommonTestEncoder` does JavaScript a bit differently
  - "JavaScriptEncode[[...]]" -> "JavaScriptStringEncode[[...]]"
- side benefit: xUnit reports functional tests execute for only ~12.4s; was >30s before this change

nits:
- touched-up some leftover `_app` &c declarations to be more explicit and minimize `using`s
- moved statements into correct sections of methods in `RoutingTests`
- removed `TestLoggerFactory` and related classes from `TagHelperSampleTest`
@dougbu
Copy link
Contributor Author

dougbu commented Sep 15, 2015

/cc @pranavkm (note we only went though the first commit last week)

}
}

private class TestDisposable : IDisposable
[Theory]
[MemberData(nameof(PathData))]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two overlapping changes aren't easy to read here:

  • don't need TestLoggerFactory plus NullLoggerFactory
  • Home_Pages_ReturnSuccess() should never have been a single test with a loop in it

@pranavkm
Copy link
Contributor

:shipit:

@dougbu
Copy link
Contributor Author

dougbu commented Sep 15, 2015

d03a851

@dougbu dougbu closed this Sep 15, 2015
@dougbu dougbu deleted the dougbu/max.fixtures.3066 branch September 15, 2015 17:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants