public async Task GetEditProductModel_ReturnsIsSuccessfulEqualFalse_If_CatchedPermissionException() { var expectedException = new PermissionException("msg"); var prodManager = new Mock <IProductManager>(); prodManager.Setup(x => x.GetProduct(It.IsAny <int>(), It.IsAny <int>())) .ThrowsAsync(expectedException); var productService = new ProductServiceBuilder() .WithProductManager(prodManager.Object) .Build(); // Act var result = await productService.GetEditProductModel(1, 1); // Assert Assert.False(result.IsSuccessful); Assert.Contains(expectedException.Message, result.Message); }