Skip to content

Commit

Permalink
Add module init for docfx.Test (#5041)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeih authored Aug 29, 2019
1 parent 2422e32 commit caaae68
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
7 changes: 0 additions & 7 deletions test/docfx.Test/DocfxTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Xunit;
using Xunit.Sdk;

namespace Microsoft.Docs.Build
{
Expand All @@ -26,12 +25,6 @@ public static class DocfxTest

static DocfxTest()
{
Environment.SetEnvironmentVariable("DOCFX_APPDATA_PATH", Path.GetFullPath("appdata"));
Environment.SetEnvironmentVariable("DOCFX_GLOBAL_CONFIG_PATH", Path.GetFullPath("docfx.test.yml"));

Log.ForceVerbose = true;
TestUtility.MakeDebugAssertThrowException();

AppData.GetCachePath = () => t_cachePath.Value;
GitUtility.GitRemoteProxy = remote =>
{
Expand Down
3 changes: 3 additions & 0 deletions test/docfx.Test/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Weavers>
<ModuleInit />
</Weavers>
20 changes: 20 additions & 0 deletions test/docfx.Test/ModuleInitializer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.IO;

namespace Microsoft.Docs.Build
{
public static class ModuleInitializer
{
public static void Initialize()
{
Environment.SetEnvironmentVariable("DOCFX_APPDATA_PATH", Path.GetFullPath("appdata"));
Environment.SetEnvironmentVariable("DOCFX_GLOBAL_CONFIG_PATH", Path.GetFullPath("docfx.test.yml"));

Log.ForceVerbose = true;
TestUtility.MakeDebugAssertThrowException();
}
}
}
3 changes: 3 additions & 0 deletions test/docfx.Test/docfx.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<FodyGenerateXsd>false</FodyGenerateXsd>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="LibGit2Sharp" Version="0.27.0-preview-0007" />
<PackageReference Include="Fody" Version="6.0.0" />
<PackageReference Include="ModuleInit.Fody" Version="2.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit caaae68

Please sign in to comment.