StopServer() public method

public StopServer ( string serverId ) : bool
serverId string
return bool
        public void StopServerTest()
        {
            var osm = new OpenStackMember(UserName, Password, TenantName, TenantId);
            SimpleServer ss = osm.ListServers().FirstOrDefault(s => s.GetDetails().Status == ServerState.Active);
            Server server = osm.GetServer(ss.Id);

            // check server status
            if (server.VMState == VirtualMachineState.Stopped)
            {
                if (server.Status != ServerState.Reboot)
                    osm.StartServer(server.Id);
                // wait for activate
                osm.ServersProvider.WaitForServerActive(server.Id);
                Trace.WriteLine(String.Format("server activated : {0}", DateTime.Now));

                // stop server
                bool b = osm.StopServer(server.Id);
                Assert.IsTrue(b);
                var vmState = server.VMState;
                Trace.WriteLine(string.Format("server stopped : {0}", DateTime.Now));
            }
            else
            {
                Trace.WriteLine(string.Format("server.Status : {0}", server.Status));
                Trace.WriteLine(string.Format("server.VMState : {0}", server.VMState));
            }
        }
        public void StopServerTest_Stop_VM_Not_Exist()
        {
            var os = new OpenStackMember(UserName, Password, TenantName, TenantId);

            // expect ItemNotFoundException
            bool b = os.StopServer(InvalidId);
        }
        public void StartServerTest()
        {
            var osm = new OpenStackMember(UserName, Password, TenantName, TenantId);
            SimpleServer ss = osm.ListServers().FirstOrDefault(s => s.GetDetails().Status == ServerState.Active);
            Server server = osm.GetServer(ss.Id);

            // check server status
            if (server.Status == ServerState.Active && server.VMState == VirtualMachineState.Active)
            {
                osm.StopServer(server.Id);
                // wait for stop
                WaitForVMState(server.Id, new[] { VirtualMachineState.Stopped }, new[] { VirtualMachineState.Error });
                Trace.WriteLine(String.Format("server stopped : {0}", DateTime.Now));

                // start server
                bool b = osm.StartServer(server.Id);
                Assert.IsTrue(b);
                Trace.WriteLine(string.Format("server started : {0}", DateTime.Now));
            }
            else
            {
                Trace.WriteLine(string.Format("server.Status : {0}", server.Status));
                Trace.WriteLine(string.Format("server.VMState : {0}", server.VMState));
            }
        }