Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2238056
Showing
40 changed files
with
2,453 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Oo]bj | ||
[Bb]in | ||
*.user | ||
*.suo | ||
*.[Cc]ache | ||
*.bak | ||
*.ncb | ||
*.log | ||
*.DS_Store | ||
[Tt]humbs.db | ||
_ReSharper.* | ||
*.resharper | ||
Ankh.NoLoad | ||
*.mdb |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>8.0.30703</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{DA25A63D-03A0-4866-84FF-48A2A8CF9101}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>MetroLog.Tests</RootNamespace> | ||
<AssemblyName>MetroLog.Tests</AssemblyName> | ||
<DefaultLanguage>en-US</DefaultLanguage> | ||
<FileAlignment>512</FileAlignment> | ||
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<PackageCertificateKeyFile>MetroLog.Tests_TemporaryKey.pfx</PackageCertificateKeyFile> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE;NETFX_CORE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'"> | ||
<DebugSymbols>true</DebugSymbols> | ||
<OutputPath>bin\ARM\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants> | ||
<NoWarn>;2008</NoWarn> | ||
<DebugType>full</DebugType> | ||
<PlatformTarget>ARM</PlatformTarget> | ||
<UseVSHostingProcess>false</UseVSHostingProcess> | ||
<ErrorReport>prompt</ErrorReport> | ||
<Prefer32Bit>true</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'"> | ||
<OutputPath>bin\ARM\Release\</OutputPath> | ||
<DefineConstants>TRACE;NETFX_CORE</DefineConstants> | ||
<Optimize>true</Optimize> | ||
<NoWarn>;2008</NoWarn> | ||
<DebugType>pdbonly</DebugType> | ||
<PlatformTarget>ARM</PlatformTarget> | ||
<UseVSHostingProcess>false</UseVSHostingProcess> | ||
<ErrorReport>prompt</ErrorReport> | ||
<Prefer32Bit>true</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> | ||
<DebugSymbols>true</DebugSymbols> | ||
<OutputPath>bin\x64\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants> | ||
<NoWarn>;2008</NoWarn> | ||
<DebugType>full</DebugType> | ||
<PlatformTarget>x64</PlatformTarget> | ||
<UseVSHostingProcess>false</UseVSHostingProcess> | ||
<ErrorReport>prompt</ErrorReport> | ||
<Prefer32Bit>true</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> | ||
<OutputPath>bin\x64\Release\</OutputPath> | ||
<DefineConstants>TRACE;NETFX_CORE</DefineConstants> | ||
<Optimize>true</Optimize> | ||
<NoWarn>;2008</NoWarn> | ||
<DebugType>pdbonly</DebugType> | ||
<PlatformTarget>x64</PlatformTarget> | ||
<UseVSHostingProcess>false</UseVSHostingProcess> | ||
<ErrorReport>prompt</ErrorReport> | ||
<Prefer32Bit>true</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | ||
<DebugSymbols>true</DebugSymbols> | ||
<OutputPath>bin\x86\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants> | ||
<NoWarn>;2008</NoWarn> | ||
<DebugType>full</DebugType> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<UseVSHostingProcess>false</UseVSHostingProcess> | ||
<ErrorReport>prompt</ErrorReport> | ||
<Prefer32Bit>true</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> | ||
<OutputPath>bin\x86\Release\</OutputPath> | ||
<DefineConstants>TRACE;NETFX_CORE</DefineConstants> | ||
<Optimize>true</Optimize> | ||
<NoWarn>;2008</NoWarn> | ||
<DebugType>pdbonly</DebugType> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<UseVSHostingProcess>false</UseVSHostingProcess> | ||
<ErrorReport>prompt</ErrorReport> | ||
<Prefer32Bit>true</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<AppXPackage>True</AppXPackage> | ||
<AppxPackageIncludePrivateSymbols>true</AppxPackageIncludePrivateSymbols> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<!--A reference to the entire .Net Framework and Windows SDK are automatically included--> | ||
<SDKReference Include="MSTestFramework, Version=11.0" /> | ||
<SDKReference Include="TestPlatform, Version=11.0" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Objects\BrokenTarget.cs" /> | ||
<Compile Include="Objects\TestLoggable.cs" /> | ||
<Compile Include="Objects\TestTarget.cs" /> | ||
<Compile Include="Tests\BrokenTargetTests.cs" /> | ||
<Compile Include="Tests\FileSnapshotTests.cs" /> | ||
<Compile Include="Tests\ILoggableTests.cs" /> | ||
<Compile Include="Tests\LevelTests.cs" /> | ||
<Compile Include="Tests\LoggerTests.cs" /> | ||
<Compile Include="Tests\LogManagerTests.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<AppxManifest Include="Package.appxmanifest"> | ||
<SubType>Designer</SubType> | ||
</AppxManifest> | ||
<None Include="MetroLog.Tests_TemporaryKey.pfx" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="Images\UnitTestLogo.png"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
<Content Include="Images\UnitTestSmallLogo.png"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
<Content Include="Images\UnitTestSplashScreen.png"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
<Content Include="Images\UnitTestStoreLogo.png"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\MetroLog\MetroLog.csproj"> | ||
<Project>{65e2062e-aac2-4054-aae6-d6764040c769}</Project> | ||
<Name>MetroLog</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '11.0' "> | ||
<VisualStudioVersion>11.0</VisualStudioVersion> | ||
</PropertyGroup> | ||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using MetroLog.Layouts; | ||
using MetroLog.Targets; | ||
|
||
namespace MetroLog.Tests | ||
{ | ||
internal class BrokenTarget : Target | ||
{ | ||
internal BrokenTarget() | ||
: base(new SingleLineLayout()) | ||
{ | ||
} | ||
|
||
protected override void Write(LogEventInfo entry) | ||
{ | ||
// broken... | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MetroLog.Tests | ||
{ | ||
public class TestLoggable : ILoggable | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using MetroLog.Layouts; | ||
using MetroLog.Targets; | ||
|
||
namespace MetroLog.Tests | ||
{ | ||
internal class TestTarget : Target | ||
{ | ||
internal int NumWritten { get; private set; } | ||
internal LogEventInfo LastWritten { get; private set; } | ||
|
||
private static TestTarget _current = new TestTarget(); | ||
|
||
private TestTarget() | ||
: base(new SingleLineLayout()) | ||
{ | ||
} | ||
|
||
internal static TestTarget Current | ||
{ | ||
get | ||
{ | ||
if(_current == null) | ||
throw new ObjectDisposedException("TestTarget"); | ||
return _current; | ||
} | ||
} | ||
|
||
protected override void Write(LogEventInfo entry) | ||
{ | ||
this.NumWritten++; | ||
this.LastWritten = entry; | ||
} | ||
|
||
internal void Reset() | ||
{ | ||
this.NumWritten = 0; | ||
this.LastWritten = null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest"> | ||
|
||
<Identity Name="022f7651-45b5-473d-ac50-5149ff5d103c" | ||
Publisher="CN=Matthew" | ||
Version="1.0.0.0" /> | ||
|
||
<Properties> | ||
<DisplayName>MetroLog.Tests</DisplayName> | ||
<PublisherDisplayName>Matthew</PublisherDisplayName> | ||
<Logo>Images\UnitTestStoreLogo.png</Logo> | ||
<Description>MetroLog.Tests</Description> | ||
</Properties> | ||
|
||
<Prerequisites> | ||
<OSMinVersion>6.2</OSMinVersion> | ||
<OSMaxVersionTested>6.2</OSMaxVersionTested> | ||
</Prerequisites> | ||
|
||
<Resources> | ||
<Resource Language="x-generate"/> | ||
</Resources> | ||
|
||
<Applications> | ||
<Application Id="vstest.executionengine.App" | ||
Executable="vstest.executionengine.appcontainer.exe" | ||
EntryPoint="vstest.executionengine.App"> | ||
<VisualElements | ||
DisplayName="NoUIEntryPoints" | ||
Logo="Images\UnitTestLogo.png" | ||
SmallLogo="Images\UnitTestSmallLogo.png" | ||
Description="vstest.executionengine.App" | ||
ForegroundText="light" | ||
BackgroundColor="#0084FF"> | ||
<SplashScreen Image="Images\UnitTestSplashScreen.png" /> | ||
</VisualElements> | ||
</Application> | ||
|
||
<Application Id="vstest.executionengine.x86.App" | ||
Executable="vstest.executionengine.appcontainer.x86.exe" | ||
EntryPoint="vstest.executionengine.x86.App"> | ||
<VisualElements | ||
DisplayName="NoUIEntryPoints" | ||
Logo="Images\UnitTestLogo.png" | ||
SmallLogo="Images\UnitTestSmallLogo.png" | ||
Description="vstest.executionengine.x86.App" | ||
ForegroundText="light" | ||
BackgroundColor="#0084FF"> | ||
<SplashScreen Image="Images\UnitTestSplashScreen.png" /> | ||
</VisualElements> | ||
</Application> | ||
</Applications> | ||
|
||
</Package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("MetroLog.Tests")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("MetroLog.Tests")] | ||
[assembly: AssemblyCopyright("Copyright © 2012")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; | ||
|
||
namespace MetroLog.Tests | ||
{ | ||
[TestClass] | ||
public class BrokenTargetTests | ||
{ | ||
[TestInitialize] | ||
public void Initialize() | ||
{ | ||
LogManager.Reset(); | ||
|
||
// add a broken target, then the normal target... | ||
LogManager.DefaultConfiguration.AddTarget(LogLevel.Trace, LogLevel.Fatal, new BrokenTarget()); | ||
LogManager.DefaultConfiguration.AddTarget(LogLevel.Trace, LogLevel.Fatal, TestTarget.Current); | ||
} | ||
|
||
[TestMethod] | ||
public void TestBrokenTarget() | ||
{ | ||
TestTarget.Current.Reset(); | ||
|
||
// this should ignore errors in the broken target and flip down to the working target... | ||
var logger = LogManager.GetLogger("Foobar"); | ||
logger.Trace("Hello, world."); | ||
|
||
// check... | ||
Assert.AreEqual(1, TestTarget.Current.NumWritten); | ||
Assert.AreEqual(LogLevel.Trace, TestTarget.Current.LastWritten.Level); | ||
Assert.IsNull(TestTarget.Current.LastWritten.Exception); | ||
} | ||
} | ||
} |
Oops, something went wrong.