public void DoesNotRetrieveToken() { var jira = TestableJira.CreateAnonymous(); jira.SoapService.Setup(s => s.Login(It.IsAny <string>(), It.IsAny <string>())).Throws(new Exception("Unexpected call to login")); string innerToken = null; jira.WithToken(t => innerToken = t); Assert.Null(innerToken); }
public void DoesNotRetrieveTokenIfMethodThrowsException() { var jira = TestableJira.CreateAnonymous(); jira.SoapService.Setup(s => s.Login(It.IsAny <string>(), It.IsAny <string>())).Throws(new Exception("Unexpected call to login")); string innerToken = null; Assert.Throws(typeof(InvalidOperationException), () => jira.WithToken(t => { innerToken = t; throw new InvalidOperationException(); })); jira.WithToken(t => innerToken = t); Assert.Null(innerToken); }