Пример #1
0
        private static CentralinoLines ReadFromCentralino(CentralinoReader centralinoReader, ILog log, CentralinoConfiguration centralinoConfiguration)
        {
            log.Info($"Starting to read lines from centralino {centralinoConfiguration.Host}:{centralinoConfiguration.Port}");
            var task = centralinoReader.ReadAllLines();

            task.Wait();
            CentralinoLines allLines = task.Result;

            log.Info($"Read {allLines.Lines.Length} lines from centralino {centralinoConfiguration.Host}:{centralinoConfiguration.Port}");
            return(allLines);
        }
Пример #2
0
        public async Task GIVEN_ARunningCentralinoServer_ICan_ReadAllTheLines()
        {
            const int port = 2300;

            using Task <OpenCentralinoMock> centralino = new CentralinoMockServer(Host, port, _serverSourceFile).StartServer();

            var reader = new CentralinoReader(new CentralinoConfiguration(Host, port, "SMDR", "SMDR"));

            var readLinesTask = reader.ReadAllLines(); readLinesTask.Wait();
            var actualLines   = readLinesTask.Result;

            Assert.Equal(CentralinoLines.Parse(_expectedLines), actualLines);

            await centralino;
        }