DI Example
This commit is contained in:
@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DependencyExample.Core\DependencyExample.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
|
||||
namespace DependencyExample
|
||||
{
|
||||
public class MockFileManager : IFileManager
|
||||
{
|
||||
private string mData;
|
||||
|
||||
public bool FailOnPurpose { get; set; }
|
||||
|
||||
public string GetFileData(string path)
|
||||
{
|
||||
return mData;
|
||||
}
|
||||
|
||||
public void WriteFileData(string path, string data)
|
||||
{
|
||||
DependencyProvider.Logger.LogMessage($"Mocking `{data}` to `{path}`, appending ` mock` to the end");
|
||||
|
||||
if (FailOnPurpose)
|
||||
mData = $"{data} mock";
|
||||
else
|
||||
mData = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user