public async Task NotFoundPackageAbortsEarly() { var writer = new MockTextWriter(); var settings = Substitute.For<IChauffeurSettings>(); string dir; settings.TryGetChauffeurDirectory(out dir).Returns(x => { x[0] = ""; return true; }); var package = new PackageDeliverable(null, writer, new MockFileSystem(), settings, null, null); await package.Run(null, new[] { "Test" }); Assert.That(writer.Messages.Count(), Is.EqualTo(1)); }
public async Task HavingMacrosWillReadThemIn() { var writer = new MockTextWriter(); var settings = Substitute.For<IChauffeurSettings>(); string dir; settings.TryGetChauffeurDirectory(out dir).Returns(x => { x[0] = ""; return true; }); var fs = new MockFileSystem(new Dictionary<string, MockFileData> { { "Text.xml", new MockFileData(macrosXml) } }); var packagingService = Substitute.For<IPackagingService>(); packagingService.ImportMacros(Arg.Any<XElement>()).Returns(Enumerable.Empty<IMacro>()); var package = new PackageDeliverable(null, writer, fs, settings, packagingService, Substitute.For<IContentTypeService>()); await package.Run(null, new[] { "Text" }); packagingService.Received(1).ImportMacros(Arg.Any<XElement>()); }
public async Task NoPackagesAbortsEarly() { var writer = Substitute.ForPartsOf<TextWriter>(); var package = new PackageDeliverable(null, writer, null, null, null, null); await package.Run(null, new string[0]); writer.Received(1).WriteLineAsync(Arg.Any<string>()).IgnoreAwaitForNSubstituteAssertion(); }