public async Task SendBestillingMailIkkeOK() { mockRep.Setup(s => s.SendBestillingMail(It.IsAny <string>(), It.IsAny <int>())).ReturnsAsync(false); var BestillingController = new BestillingController(mockRep.Object, mockLog.Object); //Act var resultat = await BestillingController.SendBestillingMail(It.IsAny <string>(), It.IsAny <int>()) as BadRequestObjectResult; //Assert Assert.Equal((int)HttpStatusCode.BadRequest, resultat.StatusCode); Assert.Equal("Mail om bestilling ble ikke sendt", resultat.Value); }