Beispiel #1
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;
        }
Beispiel #2
0
        public async Task GIVEN_ARunningCentralinoServer_IWant_ToLimit_TheNumberOfLinesThatIRead()
        {
            const int port = 2400;

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

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

            var readLinesTask = reader.ReadLines(2); readLinesTask.Wait();
            var actualLines   = readLinesTask.Result;
            var expected      = CentralinoLines.Parse(_expectedLines.Take(2).ToArray());

            Assert.Equal(expected, actualLines);

            await centralino;
        }