/// <summary> /// NOTE: This should only be called once per test as each time you call it you will get a new instance. /// </summary> public static MockFileSystem GetMockFileSystem(this AppUpdaterBuilder builder) { var fileSystem = new MockFileSystem(TestConstants.AppDirectory); builder.FileSystemAccessedThrough(fileSystem); return fileSystem; }
void AndGivenAnAppUpdater() { var builder = new AppUpdaterBuilder(TestConstants.AppPackageId) .SetupWithTestValues(_installedVersion); _fileSystem = builder.GetMockFileSystem(); _appUpdater = builder.Build(); }
void GivenAnApplicationDirectoryContainingAppFiles() { _installedVersion = new Version(1, 0); _builder = new AppUpdaterBuilder(TestConstants.AppPackageId) .SetupWithTestValues(_installedVersion); _fileSystem = _builder.GetMockFileSystem(); _appFiles = new[] { "app.exe", "app.exe.config", "nuget.dll", "data.db", "content\\logo.png" }; foreach (var file in _appFiles) _fileSystem.AddFile(Path.Combine(AppDirectory, file), MockFileContent(file, _installedVersion)); }
protected void VerifyFile(MockFileSystem fileSystem, string file, Version version) { fileSystem.ReadAllText(file).ShouldBe(MockFileContent(Path.GetFileName(file), version)); }