Пример #1
0
        public void CanCreateSourceControlSyncJob()
        {
            using (var context = MockContext.Start(GetType().FullName))
            {
                using (var testFixture = new AutomationTestBase(context))
                {
                    var sourceControlName      = SourceControlDefinition.TestSimpleSourceControlDefinition.SourceControlName;
                    var repoUrl                = SourceControlDefinition.TestSimpleSourceControlDefinition.RepoUrl;
                    var branch                 = SourceControlDefinition.TestSimpleSourceControlDefinition.Branch;
                    var folderPath             = SourceControlDefinition.TestSimpleSourceControlDefinition.FolderPath;
                    var autoSync               = SourceControlDefinition.TestSimpleSourceControlDefinition.AutoSync;
                    var publishRunbook         = SourceControlDefinition.TestSimpleSourceControlDefinition.PublishRunbook;
                    var sourceControlType      = SourceControlDefinition.TestSimpleSourceControlDefinition.SourceType;
                    var securityToken          = SourceControlDefinition.TestSimpleSourceControlDefinition.AccessToken;
                    var description            = SourceControlDefinition.TestSimpleSourceControlDefinition.Description;
                    var updateBranchName       = SourceControlDefinition.TestSimpleSourceControlDefinition.UpdateBranchName;
                    var SourceControlSyncJobId = TestUtilities.GenerateGuid("jobId");

                    var sourceControl = testFixture.CreateSourceControl(sourceControlName, repoUrl, branch, folderPath, autoSync, publishRunbook,
                                                                        sourceControlType, securityToken, description);

                    var retrievedSourceControl = testFixture.GetSourceControl(sourceControlName);
                    Assert.NotNull(retrievedSourceControl);

                    var syncJob = testFixture.CreateSourceControlSyncJob(sourceControlName, SourceControlSyncJobId);

                    var retrievedSyncJob = testFixture.GetSourceControlSyncJob(sourceControlName, SourceControlSyncJobId);

                    Assert.NotNull(retrievedSyncJob);
                    Assert.Equal(retrievedSyncJob.SourceControlSyncJobId, SourceControlSyncJobId.ToString());
                    Assert.Equal(retrievedSyncJob.CreationTime, syncJob.CreationTime);
                    Assert.Equal(retrievedSyncJob.ProvisioningState, syncJob.ProvisioningState);
                    Assert.Equal(retrievedSyncJob.StartTime, syncJob.StartTime);
                    Assert.Equal(retrievedSyncJob.EndTime, syncJob.EndTime);
                    //Assert.Equal(retrievedSyncJob.SyncType, syncJob.SyncType);

                    var syncJobList = testFixture.GetSourceControlSyncJobs(sourceControlName);

                    Assert.NotNull(syncJobList);
                    Assert.Single(syncJobList.ToList());
                    syncJob = syncJobList.ToList()[0];
                    Assert.Equal(syncJob.SourceControlSyncJobId, syncJob.SourceControlSyncJobId);
                }
            }
        }