View asyncmain.cs
using System;
using System.Threading.Tasks;
namespace csharp71
{
class Program
{
static async Task Main(string[] args)
{
await Task.Run(() =>
View csproj.xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
View csproj.xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
<Version>0.2.0</Version>
<Authors>Derek Comartin</Authors>
<Company />
<Description>Adds Gzip Compression as HTTP Content-Encoding to NancyFX.</Description>
<PackageLicenseUrl>https://github.com/dcomartin/Nancy.Gzip/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/dcomartin/Nancy.Gzip</PackageProjectUrl>
<PackageTags>gzip nancy nancyfx compression</PackageTags>
View ReplacerTests.cs
using Cake.Core.Diagnostics;
using FakeItEasy;
using Xunit;
namespace Cake.AppSettingReplacer.Tests
{
public class ReplacerTests
{
private readonly FakeCakeContext _context;
View Replacer.cs
using System;
using System.Xml;
using Cake.Core;
using Cake.Core.Annotations;
using Cake.Core.Diagnostics;
namespace Cake.AppSettingReplacer
{
public static class Replacer
{
View FakeCakeContext.cs
using Cake.Core;
using Cake.Core.Diagnostics;
using Cake.Core.IO;
using Cake.Core.Tooling;
using FakeItEasy;
namespace Cake.AppSettingReplacer.Tests
{
public class FakeCakeContext : ICakeContext
{
View cake.build
#r "Cake.AppSettingsReplacer.dll"
var target = Argument("target", "Default");
Task("Default")
.Does(() =>
{
ReplaceAppSetting("App.config", "Website", "CodeOpinion.com");
});
View Replacer.cs
using System;
using System.Xml;
using Cake.Core;
using Cake.Core.Annotations;
using LogLevel = Cake.Core.Diagnostics.LogLevel;
using Verbosity = Cake.Core.Diagnostics.Verbosity;
namespace Cake.AppSettingsReplacer
{
public static class Replacer
View configureServices.cs
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc()
.AddMvcOptions(options =>
{
options.OutputFormatters.Add(new PascalCaseJsonProfileFormatter());
});
}
View PascalCaseJsonProfileFormatter.cs
public class PascalCaseJsonProfileFormatter : JsonOutputFormatter
{
public PascalCaseJsonProfileFormatter() : base(new JsonSerializerSettings { ContractResolver = new DefaultContractResolver() }, ArrayPool<char>.Shared)
{
SupportedMediaTypes.Clear();
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json;profile=\"https://en.wikipedia.org/wiki/PascalCase\""));
}
}