public async Task DictionaryItemsLoadedIfNoLanguagesAreFound() { 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(packageNoLangXml) } }); var packagingService = Substitute.For <IPackagingService>(); packagingService.ImportLanguages(Arg.Any <XElement>()).Returns(Enumerable.Empty <Umbraco.Core.Models.ILanguage>()); packagingService.ImportDictionaryItems(Arg.Any <XElement>()).Returns(Enumerable.Empty <Umbraco.Core.Models.IDictionaryItem>()); var package = new DictionaryDeliverable(null, writer, fs, settings, packagingService); await package.Run(null, new[] { "Text", "y" }); packagingService.Received(0).ImportLanguages(Arg.Any <XElement>()); packagingService.Received(1).ImportDictionaryItems(Arg.Any <XElement>()); }
public async Task DeliverableExitsIfPackageNotFound() { var writer = new MockTextWriter(); var settings = Substitute.For <IChauffeurSettings>(); string dir; settings.TryGetChauffeurDirectory(out dir).Returns(x => { x[0] = ""; return(true); }); var package = new DictionaryDeliverable(null, writer, new MockFileSystem(), settings, null); await package.Run(null, new[] { "Test" }); Assert.Single(writer.Messages); }