예제 #1
0
        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));
        }
예제 #2
0
        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>());
        }
예제 #3
0
        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();
        }