public void Test_CreateDeployemntTask_RunsProperly_WhenAllIsWell() { var objectFactory = new Mock<IObjectFactory>(MockBehavior.Strict); var envInfoRepository = new Mock<IEnvironmentInfoRepository>(MockBehavior.Loose); var artifactsRepository = new Mock<IArtifactsRepository>(MockBehavior.Loose); var taskScheduler = new Mock<ITaskScheduler>(MockBehavior.Loose); var passwordCollector = new Mock<IPasswordCollector>(MockBehavior.Loose); var schedulerAppProjectInfo = new SchedulerAppProjectInfo( _ProjectName, _ArtifactsRepositoryName, _ArtifactsRepositoryDirName, _ArtifactsAreNotEnvirionmentSpecific, _SchedulerAppName, _SchedulerAppDirName, _SchedulerAppExeName, _SchedulerAppUserId, _ScheduledHour, _ScheduledMinute, _ExecutionTimeLimitInMinutes); objectFactory.Setup(o => o.CreateEnvironmentInfoRepository()).Returns(envInfoRepository.Object); objectFactory.Setup(o => o.CreateArtifactsRepository()).Returns(artifactsRepository.Object); objectFactory.Setup(o => o.CreateTaskScheduler()).Returns(taskScheduler.Object); objectFactory.Setup(o => o.CreatePasswordCollector()).Returns(passwordCollector.Object); schedulerAppProjectInfo.CreateDeploymentTask( objectFactory.Object, "configName", "buildID", "targetEnvironmentName"); }
public void Test_CreateDeployemntTask_RunsProperly_WhenAllIsWell() { var objectFactory = new Mock<IObjectFactory>(MockBehavior.Strict); var prjInfoRepository = new Mock<IProjectInfoRepository>(MockBehavior.Loose); var envInfoRepository = new Mock<IEnvironmentInfoRepository>(MockBehavior.Loose); var artifactsRepository = new Mock<IArtifactsRepository>(MockBehavior.Loose); var taskScheduler = new Mock<ITaskScheduler>(MockBehavior.Loose); var passwordCollector = new Mock<IPasswordCollector>(MockBehavior.Loose); var directoryAdapter = new Mock<IDirectoryAdapter>(MockBehavior.Loose); var fileAdapter = new Mock<IFileAdapter>(MockBehavior.Loose); var zipFileAdapter = new Mock<IZipFileAdapter>(MockBehavior.Loose); var schedulerAppProjectInfo = new SchedulerAppProjectInfo( _ProjectName, _ArtifactsRepositoryName, _AllowedEnvironmentNames, _ArtifactsRepositoryDirName, _ArtifactsAreNotEnvirionmentSpecific, _SchedulerAppDirName, _SchedulerAppExeName, new List<SchedulerAppTask> { new SchedulerAppTask( _SchedulerAppName, _SchedulerAppName, _SchedulerAppUserId, _ScheduledHour, _ScheduledMinute, _ExecutionTimeLimitInMinutes, _Repetition) }); objectFactory.Setup(o => o.CreateProjectInfoRepository()).Returns(prjInfoRepository.Object); objectFactory.Setup(o => o.CreateEnvironmentInfoRepository()).Returns(envInfoRepository.Object); objectFactory.Setup(o => o.CreateArtifactsRepository()).Returns(artifactsRepository.Object); objectFactory.Setup(o => o.CreateTaskScheduler()).Returns(taskScheduler.Object); objectFactory.Setup(o => o.CreatePasswordCollector()).Returns(passwordCollector.Object); objectFactory.Setup(o => o.CreateDirectoryAdapter()).Returns(directoryAdapter.Object); objectFactory.Setup(o => o.CreateFileAdapter()).Returns(fileAdapter.Object); objectFactory.Setup(o => o.CreateZipFileAdapter()).Returns(zipFileAdapter.Object); schedulerAppProjectInfo.CreateDeploymentTask(objectFactory.Object); }
public void Test_CreateDeployemntTask_Throws_When_ObjectFactory_null() { var schedulerAppProjectInfo = new SchedulerAppProjectInfo( _ProjectName, _ArtifactsRepositoryName, _ArtifactsRepositoryDirName, _ArtifactsAreNotEnvirionmentSpecific, _SchedulerAppName, _SchedulerAppDirName, _SchedulerAppExeName, _SchedulerAppUserId, _ScheduledHour, _ScheduledMinute, _ExecutionTimeLimitInMinutes); Assert.Throws<ArgumentNullException>( () => schedulerAppProjectInfo.CreateDeploymentTask( null, "configName", "buildID", "targetEnvironmentName")); }