示例#1
0
        public void ShouldDeleteServer()
        {
            // creating the list of servers
            List <Server> serversList = new List <Server>();

            // creating new server
            Server newServer = new Server {
                ServerID = "111", ServerURL = "111"
            };

            // creating server manager object
            IMemoryCache _cache = new MemoryCache(new MemoryCacheOptions());

            // adding the lists to the cache
            _cache.Set("servers", serversList);
            // creating the manager
            IServerManager serverManager = new ServerManager(_cache);

            // adding the server to the list
            serverManager.AddNewServer(newServer);

            // deleting the server we just added
            serverManager.DeleteServer(newServer.ServerID);

            var actual = (List <Server>)serverManager.GetAllExternalServers();

            // the list should be empty
            Assert.IsTrue(actual != null);
            Assert.AreEqual(actual.Count, 0);
            Assert.AreNotEqual(actual.Count, 1);
        }
示例#2
0
        private void cmdAddServer_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new AddServer();

            dialog.Owner = this;

            var result = dialog.ShowDialog();

            if (result == true)
            {
                ServerManager.AddNewServer(dialog.Server);
                PopulateServerLists();
            }
        }
        private void AddServerFromUiInfo()
        {
            var sdata = GetServerDataFromUi();

            ServerManager.AddNewServer(sdata);
        }