Example #1
0
        public async Task JobExtensionSetupInfo()
        {
            using (var tokenSource = new CancellationTokenSource())
                using (TestHostContext hc = CreateTestContext(tokenSource))
                {
                    var config    = hc.GetService <IConfigurationStore>();
                    var setupInfo = (List <SetupInfo>)config.GetSetupInfo();
                    setupInfo.Add(new SetupInfo()
                    {
                        Group  = "Test Group",
                        Detail = "Test Detail"
                    });
                    setupInfo.Add(new SetupInfo()
                    {
                        Detail = "Environment: test\nVersion: 123"
                    });


                    TestJobExtension testExtension = new TestJobExtension();
                    testExtension.Initialize(hc);
                    await testExtension.InitializeJob(_jobEc, _message);

                    _jobServerQueue.Verify(x => x.QueueWebConsoleLine(It.IsAny <Guid>(), "##[group]Test Group", It.IsAny <long>()), Times.Exactly(1));
                    _jobServerQueue.Verify(x => x.QueueWebConsoleLine(It.IsAny <Guid>(), "Test Detail", It.IsAny <long>()), Times.Exactly(1));

                    _jobServerQueue.Verify(x => x.QueueWebConsoleLine(It.IsAny <Guid>(), "##[group]Machine Setup Info", It.IsAny <long>()), Times.Exactly(1));
                    _jobServerQueue.Verify(x => x.QueueWebConsoleLine(It.IsAny <Guid>(), "Environment: test", It.IsAny <long>()), Times.Exactly(1));
                    _jobServerQueue.Verify(x => x.QueueWebConsoleLine(It.IsAny <Guid>(), "Version: 123", It.IsAny <long>()), Times.Exactly(1));
                }
        }
Example #2
0
 public void UpdateWebConsoleLineRateIfJobServerQueueIsNotNull()
 {
     using (var _tokenSource = new CancellationTokenSource())
         using (TestHostContext hc = CreateTestContext())
         {
             _jobRunner.JobServerQueue = hc.GetService <IJobServerQueue>();
             _jobRunner.UpdateMetadata(new JobMetadataMessage(It.IsAny <Guid>(), It.IsAny <Int32>()));
             _jobServerQueue.Verify(x => x.UpdateWebConsoleLineRate(It.IsAny <Int32>()), Times.Once());
         }
 }