Last active
June 1, 2021 18:22
-
-
Save b0urb4k1/69235cdcbee3192dd4e8cfa0ca2b3d75 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System; | |
using System.Reflection; | |
using FakeItEasy; | |
namespace test | |
{ | |
public class DummySettingsFactory : DummyFactory<ISettings> | |
{ | |
static ISettings settings = new TestSettings(); | |
protected override ISettings Create() => settings; | |
} | |
public class DummyFileProviderFactory : DummyFactory<FileProvider> | |
{ | |
static FileProvider fileProvider = A.Dummy<TestFileProvider>(); | |
protected override FileProvider Create() => fileProvider; | |
} | |
public interface ISettings | |
{} | |
public class RealSettings : ISettings | |
{ | |
public RealSettings() | |
{ | |
Console.WriteLine("ctor RealSettings"); | |
} | |
} | |
public class TestSettings : ISettings | |
{ | |
public TestSettings() | |
{ | |
Console.WriteLine("ctor TestSettings"); | |
} | |
} | |
public class FileProvider | |
{ | |
public FileProvider(string basePath, ISettings settings) | |
{ | |
// create some directories here | |
} | |
} | |
public class TestFileProvider : FileProvider | |
{ | |
public TestFileProvider(ISettings settings) | |
: base(Assembly.GetExecutingAssembly().Location, settings) | |
{ | |
} | |
} | |
public class ApplicationModule | |
{ | |
public ApplicationModule(FileProvider fileProvider) | |
{} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var app = A.Fake<ApplicationModule>(); | |
Console.WriteLine("Hello World!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment