public async Task TestSendPostWithRetryOnTimeoutFailureAsync() { using (var httpManager = new MockHttpManager()) { httpManager.AddRequestTimeoutResponseMessageMockHandler(HttpMethod.Post); httpManager.AddRequestTimeoutResponseMessageMockHandler(HttpMethod.Post); try { var msalHttpResponse = await httpManager.SendPostAsync( new Uri(TestConstants.AuthorityHomeTenant + "oauth2/token"), new Dictionary <string, string>(), new Dictionary <string, string>(), Substitute.For <ICoreLogger>()) .ConfigureAwait(false); Assert.Fail("request should have failed"); } catch (MsalServiceException exc) { Assert.IsNotNull(exc); Assert.AreEqual(MsalError.RequestTimeout, exc.ErrorCode); Assert.IsTrue(exc.InnerException is TaskCanceledException); } } }