public void ReadProperties_ValuesAreSameWiththeInternalWebJobInstance()
        {
            //Set up
            TriggeredWebJobRun jobRun = new TriggeredWebJobRun();
            TriggeredWebJob    webJob = new TriggeredWebJob()
            {
                ExtraInfoUrl = "an extra info url",
                HistoryUrl   = "a history url",
                LatestRun    = jobRun,
                Name         = "my web job name",
                Type         = WebJobType.Triggered,
                RunCommand   = "my run command",
                Url          = new System.Uri("http://myWebJobUrl")
            };

            // Test
            PSTriggeredWebJob wrapper = new PSTriggeredWebJob(webJob);

            // Assert
            Assert.Equal(webJob.ExtraInfoUrl, wrapper.ExtraInfoUrl);
            Assert.Equal(webJob.HistoryUrl, wrapper.HistoryUrl);
            Assert.Equal(new PSTriggeredWebJobRun(webJob.LatestRun).ToString(), wrapper.LatestRun.ToString());
            Assert.Equal(webJob.Name, wrapper.JobName);
            Assert.Equal(webJob.RunCommand, wrapper.RunCommand);
            Assert.Equal(webJob.Type, wrapper.JobType);
            Assert.Equal(webJob.Url, wrapper.Url);
        }
 public PSTriggeredWebJobRun(TriggeredWebJobRun triggeredWebJobRun)
 {
     Duration  = triggeredWebJobRun.Duration;
     EndTime   = triggeredWebJobRun.EndTime;
     Id        = triggeredWebJobRun.Id;
     JobName   = triggeredWebJobRun.JobName;
     OutputUrl = triggeredWebJobRun.OutputUrl;
     StartTime = triggeredWebJobRun.StartTime;
     Status    = triggeredWebJobRun.Status;
     Url       = triggeredWebJobRun.Url;
 }
        public void WriteProperties_InternalWebJobInstanceIsUpdated()
        {
            //Set up
            TriggeredWebJobRun jobRun = new TriggeredWebJobRun();
            TriggeredWebJob    webJob = new TriggeredWebJob()
            {
                Type = WebJobType.Triggered,
            };

            string             jobName        = "My Job Name";
            WebJobType         jobType        = WebJobType.Triggered;
            string             detailedStatus = "some details";
            string             extraInfoUrl   = "an extra info url";
            string             historyUrl     = "a history url";
            TriggeredWebJobRun latestRun      = new TriggeredWebJobRun();
            string             logUrl         = "a log url";
            string             status         = "my web job status";
            string             runCommand     = "my run command";
            Uri url = new System.Uri("http://myWebJobUrl");

            // Test
            PSTriggeredWebJob wrapper = new PSTriggeredWebJob(webJob);

            wrapper.JobType      = jobType;
            wrapper.JobName      = jobName;
            wrapper.ExtraInfoUrl = extraInfoUrl;
            wrapper.HistoryUrl   = historyUrl;
            wrapper.LatestRun    = latestRun;
            wrapper.RunCommand   = runCommand;
            wrapper.Url          = url;

            // Assert
            Assert.AreEqual(jobName, wrapper.JobName);
            Assert.AreEqual(jobType, wrapper.JobType);
            Assert.AreEqual(extraInfoUrl, wrapper.ExtraInfoUrl);
            Assert.AreEqual(historyUrl, wrapper.HistoryUrl);
            Assert.AreEqual(latestRun, wrapper.LatestRun);
            Assert.AreEqual(runCommand, wrapper.RunCommand);
            Assert.AreEqual(url, wrapper.Url);
            Assert.AreEqual(jobName, webJob.Name);
            Assert.AreEqual(jobType, webJob.Type);
            Assert.AreEqual(extraInfoUrl, webJob.ExtraInfoUrl);
            Assert.AreEqual(historyUrl, webJob.HistoryUrl);
            Assert.AreEqual(latestRun, webJob.LatestRun);
            Assert.AreEqual(runCommand, webJob.RunCommand);
            Assert.AreEqual(url, webJob.Url);
        }