Beispiel #1
0
        public void TestValidateInvalid()
        {
            var input = new LineInputter("what is this nonsense");

            Assert.Equal(1, AProgram.Main(_testAssembly, input.ReadLine,
                                          "validate", "--apikey", "abc"));
        }
Beispiel #2
0
        public void TestValidate()
        {
            var input = new LineInputter(Resources.TestPlatformConfig);

            Assert.Equal(0, AProgram.Main(_testAssembly, input.ReadLine,
                                          "validate", "--apiurl", "http://example.org/"));
        }
Beispiel #3
0
        public void TestProvisionDryrun()
        {
            const string expected = "plan.cpu=2&plan.memory=4096&plan.type=SSD&" +
                                    "os.name=Fedora%2032%20x64&os.app=Fedora%2032%20x64&" +
                                    "os.iso=&dryrun=True";

            using var requests = new MockVultrRequests(
                      new HttpHandler(
                          "provision", expected, ""));
            var input = new LineInputter(Resources.TestPlatformConfig);

            Assert.Equal(0, AProgram.Main(_testAssembly, input.ReadLine,
                                          "provision", "--apiurl", requests.Url, "--dryrun"));
            requests.AssertAllCalledOnce();
        }