public void GivenFailedIdentityResult_WhenHandleIsCalledWithErrors_ThenShouldThrowException() { const string exception = "Problem in code"; var mockEventBus = Substitute.For <IEventBus>(); var failedIdentityResult = new FailedIdentityResult(mockEventBus); Assert.Throws <RestException>(() => failedIdentityResult.Handle(_user, _errors, exception)); }
public void GivenFailedIdentityResult_WhenHandleIsCalledWith2Errors_ThenShouldPublish2LogErrorEvents() { const string exception = "Problem in code"; var mockEventBus = Substitute.For <IEventBus>(); var failedIdentityResult = new FailedIdentityResult(mockEventBus); try { failedIdentityResult.Handle(_user, _errors, exception); } catch { mockEventBus.Received(2).Publish(Arg.Any <ErrorLogEvent>()); } }