Пример #1
0
        public void GetLanDhcpClients_Happy_Path(string responseString)
        {
            // Arrange
            _reader.Setup(r => r.GetPageContent(It.IsAny <string>())).Returns(responseString);
            var dddWrtServices = new DdWrtServices(_reader.Object);

            // Act
            var result = dddWrtServices.GetLanDhcpClients();

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOf <IEnumerable <DhcpClient> >(result);
            Assert.AreEqual(8, result.Count());
        }
Пример #2
0
        private static void ExecuteCommand()
        {
            try
            {
                _ddWrtService = ServiceFactory.Create(_configuration.Username, _configuration.Password,
                                                      _configuration.RouterUrl);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error creating {nameof(ServiceFactory)}:{Environment.NewLine}{ex.Message}");
                _logger.Error(ex);

                return;
            }

            if (_command.ToLower() == Commands.Reboot)
            {
                ExecuteRebootRouter();

                return;
            }

            ExecuteReadCommandsAndDisplayNodes();
        }