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

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

            // Assert
            Assert.AreEqual(webJob.DetailedStatus, wrapper.DetailedStatus);
            Assert.AreEqual(webJob.ExtraInfoUrl, wrapper.ExtraInfoUrl);
            Assert.AreEqual(webJob.HistoryUrl, wrapper.HistoryUrl);
            Assert.AreEqual(webJob.LatestRun, wrapper.LatestRun);
            Assert.AreEqual(webJob.LogUrl, wrapper.LogUrl);
            Assert.AreEqual(webJob.Name, wrapper.JobName);
            Assert.AreEqual(webJob.RunCommand, wrapper.RunCommand);
            Assert.AreEqual(webJob.Status, wrapper.Status);
            Assert.AreEqual(webJob.Type, wrapper.JobType);
            Assert.AreEqual(webJob.Url, wrapper.Url);
        }
        public void WriteProperties_InternalWebJobInstanceIsUpdated()
        {
            //Set up
            WebJobRun jobRun = new WebJobRun();
            WebJob webJob = new WebJob()
            {
                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";
            WebJobRun latestRun = new WebJobRun();
            string logUrl = "a log url";
            string status = "my web job status";
            string runCommand = "my run command";
            Uri url = new System.Uri("http://myWebJobUrl");

            // Test
            PSWebJob wrapper = new PSWebJob(webJob);
            wrapper.JobType = jobType;
            wrapper.JobName = jobName;
            wrapper.DetailedStatus = detailedStatus;
            wrapper.ExtraInfoUrl = extraInfoUrl;
            wrapper.HistoryUrl = historyUrl;
            wrapper.LatestRun = latestRun;
            wrapper.LogUrl = logUrl;
            wrapper.Status = status;
            wrapper.RunCommand = runCommand;
            wrapper.Url = url;

            // Assert
            Assert.AreEqual(jobName, wrapper.JobName);
            Assert.AreEqual(jobType, wrapper.JobType);
            Assert.AreEqual(detailedStatus, wrapper.DetailedStatus);
            Assert.AreEqual(extraInfoUrl, wrapper.ExtraInfoUrl);
            Assert.AreEqual(historyUrl, wrapper.HistoryUrl);
            Assert.AreEqual(latestRun, wrapper.LatestRun);
            Assert.AreEqual(logUrl, wrapper.LogUrl);
            Assert.AreEqual(status, wrapper.Status);
            Assert.AreEqual(runCommand, wrapper.RunCommand);
            Assert.AreEqual(url, wrapper.Url);
            Assert.AreEqual(jobName, webJob.Name);
            Assert.AreEqual(jobType, webJob.Type);
            Assert.AreEqual(detailedStatus, webJob.DetailedStatus);
            Assert.AreEqual(extraInfoUrl, webJob.ExtraInfoUrl);
            Assert.AreEqual(historyUrl, webJob.HistoryUrl);
            Assert.AreEqual(latestRun, webJob.LatestRun);
            Assert.AreEqual(logUrl, webJob.LogUrl);
            Assert.AreEqual(status, webJob.Status);
            Assert.AreEqual(runCommand, webJob.RunCommand);
            Assert.AreEqual(url, webJob.Url);
        }
        public void CreatesTriggeredWebJob()
        {
            // Setup
            string jobName = "myWebJob";
            string jobFile = "job.bat";
            WebJobType jobType = WebJobType.Triggered;
            PSWebJob output = new PSWebJob() { JobName = jobName, JobType = jobType };
            websitesClientMock.Setup(f => f.CreateWebJob(websiteName, slot, jobName, jobType, jobFile)).Returns(output);
            cmdlet.JobName = jobName;
            cmdlet.JobType = jobType;
            cmdlet.JobFile = jobFile;

            // Test
            cmdlet.ExecuteCmdlet();

            // Assert
            websitesClientMock.Verify(f => f.CreateWebJob(websiteName, slot, jobName, jobType, jobFile), Times.Once());
            commandRuntimeMock.Verify(f => f.WriteObject(output), Times.Once());
        }