示例#1
0
        public async Task RequestThrowsTimeoutExceptionIfRequestTakesLongerThanTimeout()
        {
            clock.SetDelayCompleted();

            _ = await Assert.ThrowsExceptionAsync <TimeoutException>(
                async() => await client.Request(new byte[] { 1, 2, 3, 4, 5 }, 100, source));
        }
        public async Task GetLastServerRetriesWhenUnableToReadProfileDueToAccessViolation()
        {
            File.WriteAllText(filename, "lastMPServer=\"87.65.43.21:1234\";\n");

            using (FileStream writeStream = File.OpenWrite(filename))
            {
                clock.SetDelayCompleted();
                clock.DelayCalled = (source, args) => writeStream.Close();

                Server server = await ProfileParser.GetLastServer(filename, clock, source);

                Assert.AreEqual("87.65.43.21", server.Host);
                Assert.AreEqual(1234, server.Port);
            }
        }