public async Task GetProfile_InValid_Except_Test() { // Arrange _regionService .Setup(x => x.GetRegionProfileByIdAsync(It.IsAny <int>(), It.IsAny <User>())) .Throws(new Exception()); // Act var result = await _regionController.GetProfile(1); // Assert Assert.NotNull(result); Assert.IsInstanceOf <BadRequestResult>(result); }