public void TestExecuteMagic()
        {
            // no arguments
            var azureClient  = new MockAzureClient();
            var executeMagic = new ExecuteMagic(azureClient);

            executeMagic.Test(string.Empty);
            Assert.AreEqual(AzureClientAction.ExecuteJob, azureClient.LastAction);

            // single argument
            executeMagic.Test($"{operationName}");
            Assert.AreEqual(AzureClientAction.ExecuteJob, azureClient.LastAction);
            Assert.IsTrue(azureClient.ExecutedJobs.Contains(operationName));
        }
Beispiel #2
0
        public void TestExecuteMagic()
        {
            // no arguments
            var azureClient  = new MockAzureClient();
            var logger       = new UnitTestLogger <ExecuteMagic>();
            var executeMagic = new ExecuteMagic(azureClient, logger);

            executeMagic.Test(string.Empty);
            Assert.AreEqual(AzureClientAction.ExecuteJob, azureClient.LastAction);

            // single argument
            executeMagic.Test($"{operationName}");
            Assert.AreEqual(AzureClientAction.ExecuteJob, azureClient.LastAction);
            Assert.IsTrue(azureClient.ExecutedJobs.Contains(operationName));

            // jobParams argument
            Assert.IsTrue(azureClient.JobParams.IsEmpty);
            executeMagic.Test($"{operationName} jobParams={jobParams}");
            Assert.IsTrue(azureClient.JobParams.TryGetValue(jobParamsKey1, out string value1));
            Assert.AreEqual(value1, jobParamsVal1);
            Assert.IsTrue(azureClient.JobParams.TryGetValue(jobParamsKey2, out string value2));
            Assert.AreEqual(value2, jobParamsVal2);
        }