コード例 #1
0
ファイル: Tests.cs プロジェクト: richardlawley/cloudstack.net
        internal void TriggerBadApiUrlException()
        {
            try
            {
                string apiUrl = _serviceUri.AbsoluteUri.Substring(0, _serviceUri.AbsoluteUri.Length - 3);

                _logWriter("Test bad XML exception triggered by GUI URL" + apiUrl);
                var request = new StartVirtualMachineRequest();
                request.Parameters["id"] = "invalid-machine-id";
                _client.StartVirtualMachine(request);
                System.Diagnostics.Debug.Fail("Test should have triggered CloudStackException");
            }
            catch (CloudStackException cex)
            {
                _logWriter(cex.Message);
                _logWriter("Test PASSED");
            }
        }
コード例 #2
0
        internal void TriggerBadApiUrlException()
        {
            try
            {
                string apiUrl = _serviceUri.AbsoluteUri.Substring(0, _serviceUri.AbsoluteUri.Length - 3);

                _logWriter("Test bad XML exception triggered by GUI URL" + apiUrl);
                var request = new StartVirtualMachineRequest();
                request.Parameters["id"] = "invalid-machine-id";
                _client.StartVirtualMachine(request);
                System.Diagnostics.Debug.Fail("Test should have triggered CloudStackException");
            }
            catch (CloudStackException cex)
            {
                _logWriter(cex.Message);
                _logWriter("Test PASSED");
            }
        }