public void PreparePluginContainerForTransferWithoutConfiguration() { var fileSystem = new Mock <IFileSystem>(); var uploads = new Mock <IStoreUploads>(); var configuration = new Mock <IConfiguration>(); var commands = new HostApplicationCommands(fileSystem.Object, uploads.Object, configuration.Object); var task = commands.PreparePluginContainerForTransfer(typeof(string).Assembly.GetName()); Assert.Throws <AggregateException>(() => task.Wait()); }
public void PreparePluginContainerForTransfer() { var files = new List <string> { typeof(string).Assembly.LocalFilePath(), typeof(HostApplicationCommands).Assembly.LocalFilePath(), Assembly.GetExecutingAssembly().LocalFilePath() }; var mockDirectory = new MockDirectory(files); var fileSystem = new Mock <IFileSystem>(); { fileSystem.Setup(f => f.Directory) .Returns(() => mockDirectory); } var uploads = new Mock <IStoreUploads>(); { uploads.Setup(u => u.Register(It.IsAny <string>())) .Callback <string>( f => { Assert.AreEqual(files[1], f); }) .Returns(new UploadToken()) .Verifiable(); } var configuration = new Mock <IConfiguration>(); { configuration.Setup(c => c.HasValueFor(It.IsAny <ConfigurationKey>())) .Returns(true); configuration.Setup(c => c.Value <List <string> >(It.IsAny <ConfigurationKey>())) .Returns(new List <string> { "bla" }); } var commands = new HostApplicationCommands(fileSystem.Object, uploads.Object, configuration.Object); var task = commands.PreparePluginContainerForTransfer(typeof(HostApplicationCommands).Assembly.GetName()); task.Wait(); uploads.Verify(u => u.Register(It.IsAny <string>()), Times.Once()); }
public void PreparePluginContainerForTransferWithUnknownName() { var fileSystem = new Mock <IFileSystem>(); var uploads = new Mock <IStoreUploads>(); var configuration = new Mock <IConfiguration>(); { configuration.Setup(c => c.HasValueFor(It.IsAny <ConfigurationKey>())) .Returns(true); configuration.Setup(c => c.Value <List <string> >(It.IsAny <ConfigurationKey>())) .Returns(new List <string> { "bla" }); } var commands = new HostApplicationCommands(fileSystem.Object, uploads.Object, configuration.Object); var task = commands.PreparePluginContainerForTransfer(typeof(string).Assembly.GetName()); Assert.Throws <AggregateException>(() => task.Wait()); }
public void PreparePluginContainerForTransfer() { var files = new List<string> { typeof(string).Assembly.LocalFilePath(), typeof(HostApplicationCommands).Assembly.LocalFilePath(), Assembly.GetExecutingAssembly().LocalFilePath() }; var mockDirectory = new MockDirectory(files); var fileSystem = new Mock<IFileSystem>(); { fileSystem.Setup(f => f.Directory) .Returns(() => mockDirectory); } var uploads = new Mock<IStoreUploads>(); { uploads.Setup(u => u.Register(It.IsAny<string>())) .Callback<string>( f => { Assert.AreEqual(files[1], f); }) .Returns(new UploadToken()) .Verifiable(); } var configuration = new Mock<IConfiguration>(); { configuration.Setup(c => c.HasValueFor(It.IsAny<ConfigurationKey>())) .Returns(true); configuration.Setup(c => c.Value<List<string>>(It.IsAny<ConfigurationKey>())) .Returns(new List<string> { "bla" }); } var commands = new HostApplicationCommands(fileSystem.Object, uploads.Object, configuration.Object); var task = commands.PreparePluginContainerForTransfer(typeof(HostApplicationCommands).Assembly.GetName()); task.Wait(); uploads.Verify(u => u.Register(It.IsAny<string>()), Times.Once()); }
public void PreparePluginContainerForTransferWithUnknownName() { var fileSystem = new Mock<IFileSystem>(); var uploads = new Mock<IStoreUploads>(); var configuration = new Mock<IConfiguration>(); { configuration.Setup(c => c.HasValueFor(It.IsAny<ConfigurationKey>())) .Returns(true); configuration.Setup(c => c.Value<List<string>>(It.IsAny<ConfigurationKey>())) .Returns(new List<string> { "bla" }); } var commands = new HostApplicationCommands(fileSystem.Object, uploads.Object, configuration.Object); var task = commands.PreparePluginContainerForTransfer(typeof(string).Assembly.GetName()); Assert.Throws<AggregateException>(() => task.Wait()); }
public void PreparePluginContainerForTransferWithoutConfiguration() { var fileSystem = new Mock<IFileSystem>(); var uploads = new Mock<IStoreUploads>(); var configuration = new Mock<IConfiguration>(); var commands = new HostApplicationCommands(fileSystem.Object, uploads.Object, configuration.Object); var task = commands.PreparePluginContainerForTransfer(typeof(string).Assembly.GetName()); Assert.Throws<AggregateException>(() => task.Wait()); }