Skip to content

Commit

Permalink
rename NETSTANDARD_1plus => ASP_NET_CORE
Browse files Browse the repository at this point in the history
  • Loading branch information
304NotModified committed Sep 29, 2017
1 parent 412721d commit 8f0a9ba
Show file tree
Hide file tree
Showing 51 changed files with 110 additions and 107 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.IO;
using System.Text;
using System.Web;
Expand Down
2 changes: 1 addition & 1 deletion NLog.Web.AspNetCore.Tests/FakeHttpContextAccessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Collections.Specialized;
using System.Web.SessionState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System;
using System.Collections.Generic;
using System.Globalization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using NLog.Layouts;
using NLog.Targets;

#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Collections.Specialized;
using System.Web.SessionState;
Expand Down Expand Up @@ -77,7 +77,7 @@ public void KeyNotFoundRendersEmptyString_Json_Formatting()
[Fact]
public void KeyFoundRendersValue_Cookie_Mulitple_Items_Flat_Formatting()
{
#if NETSTANDARD_1plus
#if ASP_NET_CORE
//no multivalue keys in ASP.NET core
var expectedResult = "key=TEST,Key1=TEST1";
#else
Expand All @@ -95,7 +95,7 @@ public void KeyFoundRendersValue_Cookie_Mulitple_Items_Flat_Formatting()
[Fact]
public void KeyFoundRendersValue_Cookie_Multiple_Items_Flat_Formatting_separators()
{
#if NETSTANDARD_1plus
#if ASP_NET_CORE
//no multivalue keys in ASP.NET core
var expectedResult = "key:TEST|Key1:TEST1";
#else
Expand Down Expand Up @@ -170,7 +170,7 @@ public void KeyFoundRendersValue_Cookie_Mulitple_Items_Json_Formatting(bool sing
}

//no multivalue keys in ASP.NET core
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE

[Fact]
public void KeyFoundRendersVakue_Cookie_Mulitple_Cookies_Cookie_Items_Flat_Formatting()
Expand Down Expand Up @@ -199,7 +199,7 @@ public void KeyFoundRendersVakue_Cookie_Mulitple_Cookies_Cookie_Items_Json_Forma
}
#endif

#if !NETSTANDARD_1plus //todo
#if !ASP_NET_CORE //todo

[Fact]
public void CommaSeperatedCookieNamesTest_Mulitple_FLAT_Formatting()
Expand Down Expand Up @@ -268,7 +268,7 @@ private static AspNetRequestCookieLayoutRenderer CreateRenderer(bool addKey = tr
var httpContext = Substitute.For<HttpContextBase>();


#if NETSTANDARD_1plus
#if ASP_NET_CORE
IRequestCookieCollection cookies = Substitute.For<IRequestCookieCollection>();
var cookieDict = new Dictionary<string, string>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Collections.Specialized;
using System.Web.SessionState;
Expand Down Expand Up @@ -59,7 +59,7 @@ public void VariableNotFoundRendersEmptyString()
public void CulturedVariableFoundRendersValue(object expectedValue)
{
var httpContext = Substitute.For<HttpContextBase>();
#if NETSTANDARD_1plus
#if ASP_NET_CORE
httpContext.Items = new Dictionary<object, object>();
httpContext.Items.Add("key", expectedValue);
#else
Expand All @@ -81,7 +81,7 @@ public void CulturedVariableFoundRendersValue(object expectedValue)
public void VariableFoundRendersValue(object expectedValue)
{
var httpContext = Substitute.For<HttpContextBase>();
#if NETSTANDARD_1plus
#if ASP_NET_CORE
httpContext.Items = new Dictionary<object, object>();
httpContext.Items.Add("key", expectedValue);
#else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Collections.Specialized;
using System.Web.SessionState;
Expand All @@ -23,7 +23,7 @@ public class AspNetMvcActionRendererTests : TestBase
public void NullRoutesRenderersEmptyString()
{
var httpContext = Substitute.For<HttpContextBase>();
#if NETSTANDARD_1plus
#if ASP_NET_CORE
var routingFeature = Substitute.For<IRoutingFeature>();
var collection = new FeatureCollection();
collection.Set<IRoutingFeature>(routingFeature);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Web.Routing;
using System.Collections.Specialized;
Expand All @@ -25,7 +25,7 @@ public class AspNetMvcControllerRendererTests : TestBase
public void NullRoutesRenderersEmptyString()
{
var httpContext = Substitute.For<HttpContextBase>();
#if NETSTANDARD_1plus
#if ASP_NET_CORE
var routingFeature = Substitute.For<IRoutingFeature>();
var collection = new FeatureCollection();
collection.Set<IRoutingFeature>(routingFeature);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Web.Routing;
using System.Collections.Specialized;
Expand Down Expand Up @@ -203,7 +203,7 @@ private static AspNetQueryStringLayoutRenderer CreateAndMockRenderer(params Tupl
{
var renderer = new AspNetQueryStringLayoutRenderer();

#if !NETSTANDARD_1plus
#if !ASP_NET_CORE

var httpContext = Substitute.For<HttpContextBase>();
var namedClollection = new NameValueCollection();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Web.Routing;
using System.Collections.Specialized;
Expand Down Expand Up @@ -36,7 +36,7 @@ public void NullUrlRendersEmptyString()
public void HttpMethod_Set_Renderer()
{
var httpContext = Substitute.For<HttpContextBase>();
#if NETSTANDARD_1plus
#if ASP_NET_CORE
httpContext.Request.Method.Returns("POST");
#else
httpContext.Request.HttpMethod.Returns("POST");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Globalization;

#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Web.Routing;
using System.Collections.Specialized;
Expand Down Expand Up @@ -38,7 +38,7 @@ public void NullReferrerRendersEmptyString()
public void ReferrerPresentRenderNonEmptyString()
{
var httpContext = Substitute.For<HttpContextBase>();
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
httpContext.Request.UrlReferrer.Returns(new Uri("http://www.google.com/"));
#else
var headers = new HeaderDict();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Web.Routing;
using System.Collections.Specialized;
Expand Down Expand Up @@ -164,7 +164,7 @@ private static AspNetRequestUrlRenderer CreateRenderer(string hostBase, string q
{
var httpContext = Substitute.For<HttpContextBase>();

#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
var url = $"{scheme}://{hostBase}{pathBase}{page}{queryString}";
httpContext.Request.Url.Returns(new Uri(url));
#else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Web.Routing;
using System.Collections.Specialized;
Expand Down Expand Up @@ -37,7 +37,7 @@ public void NotNullUserAgentRendersEmptyString()
var httpContext = Substitute.For<HttpContextBase>();


#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
httpContext.Request.UserAgent.Returns("TEST");
#else
var headers = new HeaderDict();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
//TODO test .NET Core
using System.Collections.Specialized;
using System.IO;
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Web.Routing;
using System.Web.SessionState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
//TODO test .NET Core
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Web.Routing;
using System.Collections.Specialized;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
//TODO test .NET Core

using System;
using System.Reflection;
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Web.Routing;
using System.Collections.Specialized;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Security.Principal;
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Web.Routing;
using System.Collections.Specialized;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Security.Principal;
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Web.Routing;
using System.Collections.Specialized;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections;
using System.IO;
using System.Reflection;
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
using System.Web.Routing;
using System.Collections.Specialized;
Expand All @@ -28,7 +28,7 @@ public abstract class TestInvolvingAspNetHttpContext : TestBase, IDisposable
protected TestInvolvingAspNetHttpContext()
{
HttpContext = SetupFakeHttpContext();
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
HttpContext.Current = HttpContext;
#endif
}
Expand Down Expand Up @@ -56,7 +56,7 @@ protected XmlLoggingConfiguration CreateConfigurationFromString(string configXml

protected HttpContext SetupFakeHttpContext()
{
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
var httpRequest = SetUpHttpRequest();
var stringWriter = new StringWriter();
var httpResponse = new HttpResponse(stringWriter);
Expand All @@ -65,7 +65,7 @@ protected HttpContext SetupFakeHttpContext()
return null;
#endif
}
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
protected virtual HttpRequest SetUpHttpRequest(string query = "")
{
return new HttpRequest("", "http://stackoverflow/", query);
Expand Down
2 changes: 1 addition & 1 deletion NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>net452;netcoreapp1.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);NETSTANDARD_1plus</DefineConstants>
<DefineConstants>$(DefineConstants);ASP_NET_CORE</DefineConstants>
<AssemblyName>NLog.Web.AspNetCore.Tests</AssemblyName>
<AssemblyVersion>1.2.3.0</AssemblyVersion>
</PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions NLog.Web.AspNetCore.Tests/TestBase.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
#if NETSTANDARD_1plus
#if ASP_NET_CORE
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
#endif
Expand All @@ -16,7 +16,7 @@ public TestBase()
LogManager.ThrowExceptions = true;
}

#if NETSTANDARD_1plus
#if ASP_NET_CORE
protected class HeaderDict : Dictionary<string, StringValues>, IHeaderDictionary
{
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.Dictionary`2" /> class that is empty, has the default initial capacity, and uses the default equality comparer for the key type.</summary>
Expand All @@ -25,7 +25,7 @@ public HeaderDict()
}


}
}
#endif
}
}
}
4 changes: 2 additions & 2 deletions NLog.Web.AspNetCore/DefaultHttpContextAccessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
#else

Expand All @@ -8,7 +8,7 @@

namespace NLog.Web
{
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
/// <summary>
/// Provides the HttpContext associated with the current request.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion NLog.Web.AspNetCore/IHttpContextAccessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE

using System;
using System.Web;
Expand Down
2 changes: 1 addition & 1 deletion NLog.Web.AspNetCore/Internal/PropertyReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static object GetValue(string key, Func<string, object> getVal, bool eval

private static PropertyInfo GetPropertyInfo(object value, string propertyName)
{
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
return value?.GetType().GetProperty(propertyName);
#else
return value?.GetType().GetTypeInfo().GetDeclaredProperty(propertyName);
Expand Down
4 changes: 2 additions & 2 deletions NLog.Web.AspNetCore/Internal/RequestAccessorExtension.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Text;
using NLog.Common;
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
using System.Web;
#else
using Microsoft.AspNetCore.Http;
Expand All @@ -13,7 +13,7 @@ namespace NLog.Web.Internal
{
internal static class RequestAccessor
{
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE
internal static HttpRequestBase TryGetRequest(this HttpContextBase context)
{
try
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETSTANDARD_1plus
#if !ASP_NET_CORE

using System;
using System.Globalization;
Expand Down
Loading

0 comments on commit 8f0a9ba

Please sign in to comment.