public void AuditBenchmark_ValidInput_OkRequest() { Mock <IBenchmarkProvider> mock = new Mock <IBenchmarkProvider>(); mock.Setup(p => p.GetBenchmark()).Returns(l1); AuditBenchmarkController cp = new AuditBenchmarkController(mock.Object); OkObjectResult result = cp.AuditBenchmark() as OkObjectResult; Assert.AreEqual(200, result.StatusCode); }
public void AuditBenchmark_InvalidInput_ReturnBadRequest() { try { Mock <IBenchmarkProvider> mock = new Mock <IBenchmarkProvider>(); mock.Setup(p => p.GetBenchmark()).Returns(l2); AuditBenchmarkController cp = new AuditBenchmarkController(mock.Object); var result = cp.AuditBenchmark() as BadRequestResult; Assert.AreEqual(400, result.StatusCode); } catch (Exception e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } }