private ICommand CreateCommandChain(DeploymentItem item) { var itemContext = CreateContext(item); ICommand command; if (item.RemoveApplicationFirst) { var command6 = new UpgradeApplicationCommand(itemContext); var command5 = new CreateApplicationCommand(itemContext); var command4 = new ApplicationDeploymentCommand(itemContext, command5, command6); var command3 = new CreateApplicationTypeCommand(itemContext, command4); var command2 = new CopyImageToStoreCommand(itemContext, command3); command = new RemoveApplicationTypeCommand(itemContext, command2); } else { var command5 = new UpgradeApplicationCommand(itemContext); var command4 = new CreateApplicationCommand(itemContext); var command3 = new ApplicationDeploymentCommand(itemContext, command4, command5); var command2 = new CreateApplicationTypeCommand(itemContext, command3); command = new CopyImageToStoreCommand(itemContext, command2); } return(command); }
public CreateApplicationTypeCommandTests() { _appTypeClient = new Mock <IApplicationTypeClient>(); _innerCommand = new Mock <ICommand>(); var fabricClient = new Mock <IServiceFabricClient>(); fabricClient.Setup(c => c.ApplicationTypes).Returns(_appTypeClient.Object); _item = new DeploymentItem { PackagePath = @"c:\temp\pkg", ApplicationTypeName = "AppType", ApplicationId = "app", ApplicationTypeVersion = "1.0.0", ApplicationTypeBuildPath = "pkg" }; var context = new CommandContext { FabricClient = fabricClient.Object, Logger = Logger.Object, CurrentDeploymentItem = _item }; _command = new CreateApplicationTypeCommand(context, _innerCommand.Object); }