Граф коммитов

50 Коммитов

Автор SHA1 Сообщение Дата
Doug Bunting d56a97f593
Rename Formatting projects and more (#392)
* Rename `netstandard` Formatting projects
  - Formatting.NetCore and Formatting.NetStandard names no longer make sense

* Adjust `netstandard` Formatting output paths
  - align w/ new project names

* Use `NETSTANDARD1_3` and `Testing_NetStandard1_3`
  - `NETFX_CORE` name no longer makes much sense
  - remove both `NETFX_CORE` C# defined constant and `msbuild` property
    - manually-defined constant completely unnecessary in src/ code

* Remove RuntimePortable.sln
  - solution name no longer makes much sense and division adds little or no value
  - add .NET Standard projects to Runtime.sln
  - add solution filters for .NET Framework and .NET Standard projects
  - remove `$(BuildPortable)` property and `@(SolutionsToBuild)` item group
2023-02-28 11:52:52 -08:00
Doug Bunting 169d95fc06
Bump test project dependencies (#383)
Bump test project dependencies
- Castle.Core, Moq, and xUnit versions were all out of date
- hold xunit.runner.visualstudio version back in .NET SDK test projects
  - can be moved to latest version after we stop testing on netcoreapp2.1
- add missing xunit.analyzers reference to System.Web.Razor.Test project
- move all test projects to .NET v4.6.2 (a supported framework)
  - remove `netstandard` reference in System.Net.Http.Formatting.Test; not needed w/ new TFM & updated references
- further separate build of Microsoft.TestCommon project when invoked from NetCore.Test project
  - special case `RestorePackages` for this case
  - add System.Net.Http references to avoid conflicting versions e.g. src/ and test/ TFMs differ

React to changed xUnit APIs
- adjust Microsoft.TestCommon code
- nit: use `Array.Empty<byte>()` in `TranscodingStreamTests`
  - `TranscodingStream` `internal`s can be `private` instead

Resolve xUnit issues new analyzers find
- address xUnit2000 warnings
  - pass expected values to `Assert.Equal(...)` as correct (left) argument
- make generic method types explicit to avoid
  `error CS0121: The call is ambiguous between the following methods or properties: ...`
- note: cannot remove unnecessary xUnit1013 suppression
  - related bug (xunit/xunit#1466) apparently not fixed in 1.0.0 analyzers package
  - was xunit/xunit.analyzers#82 fix (in 2017) insufficient?

React to new Moq changes
- avoid `ProtectedMock\`1.ThrowIfPublicMethod(...)` `throw`ing
  - use new overloads introduced in the Moq 4.11.0 release
- adjust to Moq hiding the `ObjectProxy` type better
- update `ControllerContext` mocking to avoid NREs
  - setting `HttpContext.User` on the `Object` left `get` value `null` (did nothing)
- nit: use `SetupGet(...)` for another property
2023-01-30 20:52:17 -08:00
Doug Bunting 2ed73bc49d
Move NetCore project to use .NET SDK (#380)
Move NetCore project to use .NET SDK
- Formatting.NetCore now targets `netstandard1.3`
  - was `Profile259` aka `portable-net45+wp80+win8+wpa81`, approximately `netstandard1.0`
  - but Newtonsoft.Json.Bson supports `netstandard1.3` and up
- use Newtonsoft.Json.Bson in NetCore projects
- can now multi-target NetCore.Test as well
- nits:
  - align src/ Formatting projects as much as possible
  - align test/ Formatting projects as much as possible
  - clean up the Microsoft.TestCommon project slightly
- note: NetCore project names make no sense but I'm leaving them alone for this PR

React to using Newtonsoft.Json.Bson everywhere
- remove deprecated `BsonWriter` mentions entirely
- remove legacy BSON writer test workaround

Remove unnecessary `ConcurrentDictionary` class
- was not available in `Profile259`
- leave tests to confirm correct operation w/ "real" class

Remove `UriQueryUtility` because `WebUtility` is available everywhere
- leave test to confirm `WebUtility` continues to behave about the same
  - handle `WebUtility` being a `public` class
- change other tests to handle `WebUtility.UrlEncode(...)` encoding to uppercase
  - unlike `UriQueryUtility.UrlEncode(...)`

Add simple classes to NetCore project
- use `ICloneable` copy to get more classes compiling
  - helps NetCore in similar way to existing `MediaTypeHeaderValueExtensions`
- use `InvalidEnumArgumentException` copy to simplify code and testing
- both not available in `netstandard1.3` (or available packages) but easily duplicated

Remove unnecessary NetCore-specific GlobalSuppressions.cs file

Use `NameValueCollection` everywhere
- available (but not serializable) in `netstandard1.3`

Add `MaxDepth` support in NetCore assembly
- remove an unnecessary suppression about `MaxDepth` in `BaseJsonMediaTypeFormatter`

Add `UseDataContractJsonSerializer` support in NetCore assembly
- `XsdDataContractExporter` remains unavailable
  - update XML DCS tests to handle this (previously not in NetCore assembly)
- try various workarounds
  - `ReadOnlyStreamWithEncodingPreamble` causes tests to hit dotnet/runtime#80160
  - restriction to UTF8 when writing is a significant issue

Copy `TranscodingStream` and related files from dotnet/runtime
- my runtime clone was at 88868b7a781f4e5b9037b8721f30440207a7aa42

Adjust `TranscodingStream` and related code to compile and run here
- add conditions to avoid references to version-specific API
- remove references to internal dotnet/runtime code
  - rewrite some code more generically if performance impact likely minor
- use Microsoft.TestCommon instead of directly relying on Xunit in tests
- use C# 9.0

Use `TranscodingStream` in JSON and XML formatters
- remove `ReadOnlyStreamWithEncodingPreamble` and its tests
  - was insufficient in general and doesn't work correctly in `netstandard1.3`
  - see dotnet/runtime#80160
- now support a much broader set of encodings in JSON and XML formatters
  - not just UTF8, UTF16BE, and UTF16LE
  - JSON formatter already supported every encoding when `UseDataContractJsonSerializer` was `false`
    - no longer have this downside when property is `true`
    - however, quotas remain unsupported in `netstandard1.3` version of this formatter when property is `true`
  - XML formatter requirement for an XML declaration in non-UTF8 content was general and is no longer an issue

Add `MediaTypeMappings` support in NetCore assembly

Add `IRequiredMemberSelector` support in NetCore assembly

Remove unnecessary NETFX_CORE workarounds
- use `DefaultContractResolver`, `GuidAttribute`, `TypeDescriptor`, `XmlElement`, `XmlNode` classes
- use `IRequiredMemberSelector` interface
- use `RequestMessage.CreateResponse()` extension method
  - all available in `netstandard1.3`
- `JsonContractResolver` use is something of a late Newtonsoft.Json version reaction
  - was held back by missing `IRequiredMemberSelector`

Work around missing features in `netstandard1.3`
- get classes now included in NetCore assembly compiling
- `SerializationAttribute` is not available
  - therefore `Exception` is not serializable
  - therefore `DefaultContractResolver.IgnoreSerializableAttribute` is not available
- `Stream.(Begin|End)(Read|Write)` and `Stream.Close()` are not available
- nit: clean up `MultipartFormDataStreamProvider` whitespace
2023-01-28 13:39:45 -08:00
Doug Bunting 8515e0bedd
Address a few more nits (#378)
- avoid repeated NuGet.exe downloads
  - remove extra bits in modern file versions before parsing
- suppress warnings about targeting `netcoreapp2.1`
2023-01-20 10:45:23 -08:00
Doug Bunting 1e2a82c42c
Use .NET SDK in two test projects (#371)
- Use .NET SDK in NetCore.Test project
  - for now, unable to target `netcoreapp2.1` in NetCore.Test project
    - Microsoft.Net.Http is not compatible
    - System.Net.Http types have different identities, causing compilation failures
  - switch to use `dotnet vstest` for any .NET Core assemblies (just one currently)
    - can use `Xunit` target for all .NET Framework assemblies
  - make XunitXml.TestLogger available for .NET Core App testing
    - use above test logger in repo-level testing
    - integrate w/ tests that use the `Xunit` target
  - don't import from xunit.msbuild.runner when targeting .NET Core; not needed
  - add `$(CopyLocalLockFileAssemblies)` to these (now both .NET SDK) test projects
    - xUnit assemblies were not copied (when they should have been) w/o this

- Use .NET SDK in Microsoft.TestCommon
  - allows reference in .NET SDK test projects

- Create general `TestAssembly` target
  - rename WebStack.xunit.targets -> WebStack.testing.targets
  - rename `Xunit` target -> `TestAssembly`
  - move `dotnet vstest` use into new target
    - handle exit codes more consistently
2022-12-12 16:13:35 -08:00
Doug Bunting c98af896fc
Build w/ VS 2019; restore w/ `msbuild` (#375)
- handle both SDK-style and legacy projects in one way
  - set `$(RestorePackagesConfig)` to cover both project types
- allow newer .NET SDKs to align w/ VS components
- make a few `<import/>`s conditional to avoid problems in `Restore` target evaluation
- restore global packages.config before building to make StyleCop available
- move second copies of packages.config packages into packages/ folder
- update FxCop TFM
  - .NET 4.0 not supported because current FxCopSdk is built against .NET 4.7.2
- suppress new warnings about old FxCop approach and not using `IFormatProvider`
2022-12-12 11:16:33 -08:00
Doug Bunting 06589fb442
Do not fail tests immediately (#368)
- combine `RegexReplace` into `PrintTestRunSummary` task
  - remove unused `WarnOnNoMatch` parameter; inline other parameters
  - capture test summary in `msbuild` logs
    - avoid `System.Console` use in the task
  - fail task if any tests fail
- collect `xunit` task exit codes in case of catastrophic problems (not test failures)
  - fail build if `PrintTestRunSummary` doesn't but errors occurred

also:
- do not test assemblies in parallel; reduce port contention issues
- avoid `CallTarget` task

nits:
- clean some trailing whitespace in C# sources
  - mostly files I expect to update soon
- reduce `NuGet.exe restore` verbosity; no longer debugging that
- add console summary when using build.cmd
- reduce duplication in `RestorePackages` target
  - only restore NetCore projects when `$(BuildPortable)` is `true`
  - restore src NetStandard project transitively through NetStandard.Test project
- pass more properties w/ `Restore` target invocation
2022-11-23 17:07:19 -08:00
Doug Bunting 125b71acc5 Upgrade xUnit Visual Studio runner to latest stable version (v2.3.1)
- enable app domains in all testing; `denied` now breaks testing in VS
  - VS runner previously ignored this setting; see xunit/xunit#1533
- remove `"shadowCopy":  false` setting too
  - with updated xUnit packages, this setting slows testing down significantly
2017-10-31 10:09:23 -07:00
Doug Bunting 80eeedf0c8 Make `PrintTestRunSummary` task more resilient
- handle the nearly-empty `<assembly/>` elements xUnit sometimes writes to the results file

nit:
- use leading-underscore convention for private items in the `RunTests` target
- make `@(_TestDLLsXunit)` items a bit easier to read
2017-10-23 16:08:08 -07:00
Doug Bunting 4b309584ad Build tests targeting .NET 4.5.2
- precondition for other tool upgrades; xUnit in particular does not support older framework versions

No-op `test` target in Microsoft.TestCommon project
2017-10-23 08:55:23 -07:00
Doug Bunting 634c9d2863 Move to MSBuild v15.0 and latest xUnit MSBuild runner
- change `CultureUtilTest` to use `Thread.CurrentThread`
  - when hosted in latest MSBuild, changing `thread.CurrentThread` changes `Thread.CurrentThread` instead
- find current Microsoft.Build.Tasks assembly in WebStack.tasks.targets, not just the WebApiHelpPage project
- add `$(TestInParallel)`
  - allows user to e.g. build in parallel but test assemblies serially
  - default remains doing everything in parallel
- change build.cmd to set %ErrorLevel% when exiting
- add empty top-level Directory.Build.* files

Use only VS 2017 or later
- ensure same MSBuild features are available in command-line and VS builds
- move `$(MinimumVisualStudioVersion)` project settings to global location and bump required version up

Use Microsoft.NET.Sdk and `<PackageReference/>`s in .NET Standard project
- create a "real" .NET Standard 1.1 assembly, not .NET Portable v5.0

Move to latest version of the xUnit MSBuild runner
- v2.3.0 has a few bugs related to XML results files e.g. xunit/xunit#1515
- switch to current XML results format (required with v2.3.0 but doesn't hurt with later versions)
- make runner discovery version-independent
- add support for `msbuild /t:test` in test project directories
2017-10-23 08:55:04 -07:00
Doug Bunting 2667ae2db1 Add NetStandard test assembly to SkipStrongNames.xml 2017-10-16 22:06:04 -07:00
Doug Bunting 1ac3441bab Do not use C# 6.0 features
- relates to #3
- FYI CI build was fine w/ `nameof()` but disallowed `string` interpolation
- also disable these features; don't want VS offering features that won't always work
2016-08-29 19:35:45 -07:00
Doug Bunting 890f4df674 Improve speed of VS test runs
- related to #11 (4 of 4 additions)
- need xUnit.net AppDomain support in console runs but not in VS runs
 - setting in `WebStack.xunit.targets` overrides `xunit.runner.json` default
 - somewhat avoids issues such as xunit/xunit#353 and xunit/xunit#947
- pre-enumerating `[Theory]`s also slows down test discovery and execution
 - remains a good idea to leave the test execution engine running
2016-08-29 09:45:01 -07:00
Doug Bunting 2d8f6770aa Update test projects to latest stable xUnit.net packages and `nuget.exe`
- #11 (4 of 4)
- newer version of `xunit.abstractions` exists (2.0.1) but it
  "is not compatible with 'xunit.extensibility.core 2.1.0 constraint: xunit.abstractions (= 2.0.0)'"
- add xunit.runner.msbuild package to central packages.config
 - need this package to execute tests after upgrade to xUnit.net 2.1.0
 - need recent Beta to pick up PR xunit/xunit#807; MSBuild crashes otherwise
 - for this part, do not make *.csproj changes that NuGet attempts; update our `WebStack.xunit.targets` instead
- use latest `xunit.exe` because Beta xunit.runner.msbuild package needs at least 2.12
 - old 2.7 minimum version, 2.8 that is at https://nuget.org/nuget.exe, and 2.12 are also all old

Update TestCommon to match latest xUnit.net APIs
- continue to expose required xUnit.net classes in `Microsoft.TestCommon` namespace
 - adjust to `sealed` classes, namespace moves, et cetera
- do not use removed `Assert.ThrowsDelegate` and `Assert.ThrowsDelegateWithReturn` types
 - can't use these types with underlying `Assert` using `Action` and `Func<object>`
- remove `StringAssertions` since those assertions are now in xUnit.net

nits
- remove `Console.WriteLine()` from a test
- use new `Assert.Matches()` in tests checking exception messages that contain a Moq proxy type name
2016-08-29 09:41:41 -07:00
Doug Bunting 8b9b851601 Avoid inconsistent NRE in our FxCop rules
- #16
- remove temporary suppression for this rule
- add suppressions for a couple of rules violated only in Debug builds

Tested to confirm all MW120x rule suppresions are needed and therefore that rules work fine.
- removed global override for MW1200; already suppressed in one place it's needed (`RazorParser`)
2016-08-23 11:49:00 -07:00
Doug Bunting 1a987f82d6 Change source code and repo license info to .NET Foundation
- #2
- a few manual changes in `License.txt`, `Settings.StyleCop`, `CommonAssemblyInfo.*`, and
  `tools\src\Microsoft.Web.FxCop\Properties\AssemblyInfo.cs`
2016-08-08 22:03:40 -07:00
N. Taylor Mullen ba644b54dc Update dll/namespace of Microsoft.AspNet.Mvc.Facebook.
Changed it to Microsoft.AspNet.Facebook.
2014-05-16 19:34:10 -07:00
Pranav K b9d1e07f0e Microsoft.Web.FxCop builds against the wrong FxCop version
Microsoft.Web.FxCop.csproj attempts to use the 12.0 version of the FxCop
binaries even if the passed in VisualStudio version is 11.0. This causes
it to compile against 12.0 but run using the 11.0 FxCopCmd.exe causing it
to fail. Instead we'll use the passed in VisualStudioVersion to select the
FxCop SDK binaries to compile against

Work Item: 1556
2013-12-16 10:48:14 -08:00
Congyong Su de22e048cd Create webapi.odata projects for v4 OData
1. Copy System.Web.Http.OData to System.Web.OData
2. Copy System.Web.Http.OData.Test to System.Web.OData.Test
3. Generate new project guids
4. Set new src project InternalsVisibleTo to new test project
5. Update with latest changes from System.Web.Http.OData and the test project
6. Add 2 new projects to SkipStrongNames.xml
7. AssemblyTitle change
8. Move SuppressMessage from AssemblyInfo.cs to GlobalSuppressions.cs
9. Not change test project System.Web.OData.Test's RootNamespace (System.Web.Http) for now, since test resource files depend on it.
10. Suppress CA1704:IdentifiersShouldBeSpelledCorrectly for Unsortable.
2013-12-13 21:36:13 +08:00
Pranav K ffbd8ac0b8 Adding Microsoft.Web.FxCop project to the build tree 2013-12-04 15:02:10 -08:00
davidmatson ce2a68a0ea Incorporate code review feedback. 2013-10-29 14:53:46 -07:00
davidmatson 9ce99ff086 Switch to NuGet's new automatic package restore. 2013-10-28 15:52:46 -07:00
mlacouture 7b434b5cf3 Add build extensibility points and parameterize the build system to provide better control over output tasks like signing and enable servicing build artifacts separately. 2013-08-12 13:24:06 -07:00
davidmatson ca66826108 Minor build cleanup. 2013-07-02 14:02:40 -07:00
youssefm df65fe0f63 Combine System.Web.Http.Owin and System.Web.Http.OwinHost 2013-05-14 16:26:37 -07:00
raghuramn af63fa3c1f Enable SkipStrongName for System.Web.Owin and corresponding test dll
1) Enable SkipStrongName for System.Web.Owin and System.Web.Owin.Test
2) updating Runtime.sln to build System.Web.Http.Owin and
System.Web.Owin.Test into CodeAnlaysis directory
2013-05-08 12:00:39 -07:00
youssefm 9ea78b8f7b Rename System.Web.Http.Owin to System.Web.Http.OwinHost 2013-04-16 15:15:14 -07:00
youssefm 69464ad394 Update SkipStrongNames for System.Web.Http.Owin 2013-04-15 10:26:00 -07:00
yaohuang 4284ca5270 CORS support for Web API
This feature allows cross-origin requests to be made from the browser based the CORS specifications.
2013-03-12 18:36:58 -07:00
davidmatson 7825aa4e5b Move SkipStrongNames inside of build.cmd. 2013-03-05 18:04:24 -08:00
youssefm 705ccc0c1d [MQ] Merge common csproj properties into the common settings target 2013-02-18 16:41:12 -08:00
yaohuang a9ad793d18 csproj cleanups 2013-02-18 16:27:55 -08:00
youssefm 1db9afa47f [MQ] Add command-line build test summary 2013-02-15 11:49:23 -08:00
yaohuang c18dbd8306 Upgrading the projects to .NET 4.5
Updating all the package references
Upgrading to Json.Net 4.5.11
Fixing the following issues which prevent the projects from building in 4.5:
* MachineKey.Encode/Decode are deprecated in 4.5
* ParameterInfo.GetCustomAttributes<T> was added in 4.5 causing ambiguity
* UnvalidatedRequestValues was added in 4.5 causing ambiguity
2013-02-13 18:29:13 -08:00
davidmatson c942cabd8a Remove need for TestHttpNamespace.bat.
The only reason we needed to have TestHttpNamespace.bat is because some tests were taking calls for http://+:50231/ instead of http://localhost:50231/, and this behavior happened only when using HttpSelfHost. Configuring our tests not to take the broader URL space means they don't ever need admin-level access.
2012-10-31 11:12:56 -07:00
marcind 5582772a7b Add custom StyleCop rules, e.g. to detect missing copyright header 2012-08-16 16:07:29 -07:00
marcind 88176e4e31 Simplify WebStack.StyleCop.targets and make it correctly build incrementally. 2012-08-16 16:07:22 -07:00
marcind b3c69ca033 Re-enable StyleCop when running in command line builds. 2012-08-16 16:07:19 -07:00
raghuramn 98d041ae35 integration tests cleanup
1) minor cleanup in System.Web.Http.Integration.Test
2) add unreserve option for TestHttpNamespace.bat
2012-08-02 11:23:55 -07:00
bradwilson 3b39178d07 Convert to built-in NuGet package restore 2012-07-13 13:52:06 -07:00
raghuramn 0068bef72c [MQ] Enable running integration tests as non-admin
1) Use 50231 for all HttpSelfHostServer tests so that url reservation is
simpler
2) http.sys url reservation for integration tests so that they can be run as
non-admin user.
2012-07-13 13:17:54 -07:00
bradwilson d0c58d159a Added missing package to WebStackNuGetPackages list 2012-05-22 17:50:12 -07:00
pranavkm f811bef75e Updating package feed urls 2012-04-30 18:31:51 -07:00
pranavkm 69d5f295e4 Modifying NuGet.targets file to download NuGet.exe from API path 2012-04-16 13:53:37 -07:00
bradwilson 5194b674c4 Disable NuGet package restore by default 2012-03-27 10:57:48 -07:00
bradwilson 94926db8e2 Path fixup 2012-03-26 20:55:17 -07:00
bradwilson caf46a6ae0 More MyGet enablement 2012-03-26 20:52:37 -07:00
bradwilson 72cba8ff01 Updated NuGet targets to use MyGet feed 2012-03-26 20:18:15 -07:00
bradwilson 0f8c45fe03 Initial revision. 2012-03-11 10:17:56 -07:00