Example #1
0
        public void Test_AddServer()
        {
            // Setup
            string serverUrl = "http://test2.com";
            string serverId  = "test_server2";
            Server server    = new Server(serverId, serverUrl);

            var mockRemoteServersConnector = new RemoteServersConnector();
            var serversController          = new ServersController(mockRemoteServersConnector);

            // Act
            IActionResult addAction = serversController.AddServer(server);


            // Assert
            Assert.IsType <OkResult>(addAction);
            Assert.Single(mockRemoteServersConnector.GetAllServers());
        }
Example #2
0
        public void Test_DeleteServer()
        {
            // Setup
            string serverUrl = "http://test3.com";
            string serverId  = "test_server3";
            Server server    = new Server(serverId, serverUrl);

            var mockRemoteServersConnector = new RemoteServersConnector();

            mockRemoteServersConnector.AddServer(server);
            var serversController = new ServersController(mockRemoteServersConnector);

            // Act
            IActionResult delAction = serversController.DeleteServer(server.ServerId);


            // Assert
            Assert.IsType <OkResult>(delAction);
            Assert.Empty(mockRemoteServersConnector.GetAllServers());
        }