Ejemplo n.º 1
0
        public static async Task Main(string[] args)
        {
            const int            port           = 2300;
            var                  phoneCallsFile = @"Resources\costa_centralino_mock_source.txt";
            CentralinoMockServer mockServer     = new CentralinoMockServer(
                "127.0.0.1",
                port,
                phoneCallsFile);

            Console.WriteLine($"Starting server with file {phoneCallsFile} on port {port}...");
            await mockServer.StartServer();
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 3
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;
        }