コード例 #1
0
 public void GetSourceControlBlockRetrievesSingleBlockFromProject()
 {
     var expectedBlock = new SourceControlBlockStub();
     var task = new SourceControlTaskStub();
     var project = new Project("test", task);
     project.SourceControl.Add(expectedBlock);
     var actualBlock = task.RunGetSourceControlBlock();
     Assert.AreSame(expectedBlock, actualBlock);
 }
コード例 #2
0
 public void RunCallsDefaultSourceControlBlock()
 {
     var getSourceCalled = false;
     var block = new SourceControlBlockStub
                     {
                         GetSourceAction = p => getSourceCalled = true
                     };
     var task = new GetSource();
     var project = new Project("Name", task);
     project.SourceControl.Add(block);
     var result = task.Run(null);
     result.Count();
     Assert.IsTrue(getSourceCalled);
 }
コード例 #3
0
 public void GetSourceControlBlockRetrievesNamedBlockFromProject()
 {
     var blockName = "BlockToFind";
     var expectedBlock = new SourceControlBlockStub
                             {
                                 Name = blockName
                             };
     var task = new SourceControlTaskStub
                    {
                        Use = blockName
                    };
     var project = new Project("test", task);
     project.SourceControl.Add(expectedBlock);
     project.SourceControl.Add(new SourceControlBlockStub());
     var actualBlock = task.RunGetSourceControlBlock();
     Assert.AreSame(expectedBlock, actualBlock);
 }
コード例 #4
0
 public void IntegrateHandlesErrorDuringSourceControlCleanUp()
 {
     var initialised = false;
     var dummy = new SourceControlBlockStub
     {
         OnInitialise = () => initialised = true,
         OnCleanUp = () =>
                         {
                             throw new Exception("Oops");
                         }
     };
     var executionFactoryMock = new Mock<ITaskExecutionFactory>(MockBehavior.Strict);
     InitialiseExecutionContext(executionFactoryMock);
     var project = new Project("test")
                       {
                           TaskExecutionFactory = executionFactoryMock.Object
                       };
     project.SourceControl.Add(dummy);
     var request = new IntegrationRequest("Dummy");
     project.Integrate(request);
     Assert.IsTrue(initialised);
 }
コード例 #5
0
 public void IntegrateInitialisesAndCleansUpSourceControl()
 {
     var initialised = false;
     var cleanedUp = false;
     var dummy = new SourceControlBlockStub
         {
             OnInitialise = () => initialised = true,
             OnCleanUp = () => cleanedUp = true
         };
     var executionFactoryMock = new Mock<ITaskExecutionFactory>(MockBehavior.Strict);
     InitialiseExecutionContext(executionFactoryMock);
     var project = new Project("test")
                       {
                           TaskExecutionFactory = executionFactoryMock.Object
                       };
     project.SourceControl.Add(dummy);
     var request = new IntegrationRequest("Dummy");
     project.Integrate(request);
     Assert.IsTrue(initialised);
     Assert.IsTrue(cleanedUp);
 }
コード例 #6
0
 public void ValidateValidatesSourceControlBlocks()
 {
     var validateCalled = false;
     var sourceControl = new SourceControlBlockStub
                             {
                                 OnValidate = vl => validateCalled = true
                             };
     var project = new Project("Test");
     project.SourceControl.Add(sourceControl);
     var validationMock = new Mock<IValidationLog>();
     project.Validate(validationMock.Object);
     Assert.IsTrue(validateCalled);
 }