Esempio n. 1
0
        public void OnReconnectingRaisesOnErrorIfReconnectingTimesOut()
        {
            using (var connection = new Connection("http://fakeurl"))
            {
                var errorCalledResetEvent = new ManualResetEventSlim();

                connection.Error += error =>
                {
                    Assert.IsType<TimeoutException>(error);
                    Assert.Equal(
                        string.Format(CultureInfo.CurrentCulture, Resources.Error_ReconnectTimeout, new TimeSpan(0)),
                        error.Message);

                    errorCalledResetEvent.Set();
                };

                connection.OnReconnecting();

                Assert.True(errorCalledResetEvent.Wait(1000), "OnError not called");
            }
        }