public async Task Name_given___202() { var eventMock = new Mock <IEventDispatcher>(MockBehavior.Strict); var sut = new GreetingController(eventMock.Object, _loggerMock.Object); eventMock .Setup(e => e.Publish(It.IsAny <HelloQuery>(), It.IsAny <CancellationToken>())) .Returns(Task.CompletedTask) .Verifiable(); ActionResult result = await sut.HelloNotify("name"); eventMock.Verify(); Assert.Multiple(() => { Assert.IsInstanceOf <StatusCodeResult>(result); StatusCodeResult statusCodeResult = result as StatusCodeResult; Assert.AreEqual(202, statusCodeResult.StatusCode); }); }