public void MissingTaskTypeName_ThrowsError()
			{
				string projectId = Guid.NewGuid().ToString();
				string componentId = Guid.NewGuid().ToString();
				string stepName = Guid.NewGuid().ToString();
				string taskTypeName = null;
				string taskOptionsJson = Guid.NewGuid().ToString();
				var projectRepository = new Mock<IProjectRepository>();
                IProjectManager sut = new ProjectManager(projectRepository.Object, new Mock<IDeployTaskFactory>().Object);

				Assert.Throws<ArgumentNullException>(() => sut.CreateComponentDeploymentStep(projectId, componentId, stepName, taskTypeName, taskOptionsJson));
				projectRepository.Verify(i => i.CreateComponentDeploymentStep(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Never());
			}
			public void MissingTaskOptions_CreatesTaskOptions()
			{
                //var project = new DeployProject
                //{
                //    ProjectName = Guid.NewGuid().ToString(),
                //    Id = Guid.NewGuid().ToString(),
                //    UsesSharedComponentConfiguration = false
                //};
                //string componentId = Guid.NewGuid().ToString();
                //string stepName = Guid.NewGuid().ToString();
                //string taskTypeName = typeof(TestTaskType).ToString();
                //string taskOptionsJson = null;
                //var projectRepository = new Mock<IProjectRepository>();
                //projectRepository.Setup(i => i.GetProject(project.Id)).Returns(project);
                //var deployTaskFactory = new Mock<IDeployTaskFactory>();
                //deployTaskFactory.Setup(i=>i.CreateTaskDefinition(taskTypeName, It.IsAny<string>())).Returns(new TestTaskType() { DeployTaskOptions = new object() });
                //IProjectManager sut = new ProjectManager(projectRepository.Object, deployTaskFactory.Object);
                
                //var result = sut.CreateComponentDeploymentStep(project.Id, componentId, stepName, taskTypeName, taskOptionsJson);

                //Assert.IsNotNull(result);
                //Assert.AreEqual(stepName, result.StepName);
                //projectRepository.Verify(i => i.CreateComponentDeploymentStep(project.Id, componentId, stepName, taskTypeName, It.IsAny<string>(), null), Times.Once());

                string projectId = Guid.NewGuid().ToString();
                string componentId = Guid.NewGuid().ToString();
                string stepName = Guid.NewGuid().ToString();
                string taskTypeName = typeof(TestTaskType).ToString();
                string taskOptionsJson = null;
                var projectRepository = new Mock<IProjectRepository>();
                var project = new DeployProject
                {
                    Id = projectId,
                    ComponentList = new List<DeployComponent>(),
                    UsesSharedComponentConfiguration = false
                };
                projectRepository.Setup(i => i.GetProject(projectId))
                                    .Returns(project);
                projectRepository.Setup(i => i.CreateComponentDeploymentStep(project.Id, componentId, stepName, taskTypeName, It.IsAny<string>(), null))
                                    .Returns(new DeployStep
                                    {
                                        Id = Guid.NewGuid().ToString(),
                                        StepName = stepName,
                                        TaskTypeName = taskTypeName,
                                        TaskOptionsJson = taskOptionsJson,
                                        ProjectId = projectId,
                                        ParentId = componentId,
                                        SharedDeploymentStepId = Guid.NewGuid().ToString()
                                    });
                var deployTaskFactory = new Mock<IDeployTaskFactory>();
                deployTaskFactory.Setup(i=>i.CreateTaskDefinition(taskTypeName, It.IsAny<string>())).Returns(new TestTaskType() { DeployTaskOptions = new object() });
                IProjectManager sut = new ProjectManager(projectRepository.Object, deployTaskFactory.Object);

                var result = sut.CreateComponentDeploymentStep(projectId, componentId, stepName, taskTypeName, taskOptionsJson);

                Assert.IsNotNull(result);
                Assert.AreEqual(stepName, result.StepName);
                projectRepository.Verify(i => i.CreateComponentDeploymentStep(project.Id, componentId, stepName, taskTypeName, It.IsAny<string>(), null), Times.Once());
            }
			public void CanCreateDeploymentStep()
			{
				string projectId = Guid.NewGuid().ToString();
				string componentId = Guid.NewGuid().ToString();
				string stepName = Guid.NewGuid().ToString();
				string taskTypeName = typeof(TestTaskType).ToString();
				string taskOptionsJson = Guid.NewGuid().ToString();
				var projectRepository = new Mock<IProjectRepository>();
				var project = new DeployProject
									{
										Id = projectId,
										ComponentList = new List<DeployComponent>(),
										UsesSharedComponentConfiguration = false
									};
				projectRepository.Setup(i=>i.GetProject(projectId))
									.Returns(project);
				projectRepository.Setup(i=>i.CreateComponentDeploymentStep(project.Id, componentId, stepName, taskTypeName, taskOptionsJson, null))
									.Returns(new DeployStep
										{
											Id = Guid.NewGuid().ToString(),
											StepName = stepName,
											TaskTypeName = taskTypeName,
											TaskOptionsJson = taskOptionsJson,
											ProjectId = projectId,
											ParentId = componentId,
											SharedDeploymentStepId = Guid.NewGuid().ToString()
										});
                IProjectManager sut = new ProjectManager(projectRepository.Object, new Mock<IDeployTaskFactory>().Object);

				var result = sut.CreateComponentDeploymentStep(projectId, componentId, stepName, taskTypeName, taskOptionsJson);

				Assert.IsNotNull(result);
				Assert.AreEqual(stepName, result.StepName);
				projectRepository.Verify(i=>i.CreateComponentDeploymentStep(project.Id, componentId, stepName, taskTypeName, taskOptionsJson, null), Times.Once());
			}