public void GetClinicalByID_Return_OkResult() { //arrange ClinicalDataAccessLayer testClinicalAccess = new ClinicalDataAccessLayer(); var postId = 1; //act Clinical data = testClinicalAccess.GetClinicalData(postId); //assert Assert.IsType <Clinical>(data); }
public void GetClinicalByID_Return_NotFoundResult() { //arrange ClinicalDataAccessLayer testClinicalAccess = new ClinicalDataAccessLayer(); int postId = -1000; //act Clinical data = testClinicalAccess.GetClinicalData(postId); if (data == null) { //assert Assert.IsType <BadRequestResult>(data); } }
public void UpdateValidData_Return_OkResult() { //arrange ClinicalDataAccessLayer testClinicalAccess = new ClinicalDataAccessLayer(); var postId = 1; int expected = 1; //1 = successfully added to DB //act Clinical existingPost = testClinicalAccess.GetClinicalData(postId); existingPost.Name = "Test Name Updated"; int returnVal = testClinicalAccess.UpdateClinical(existingPost); //assert Assert.Equal(expected, returnVal); }
public void UpdateInvalidData_Return_NotFound() { //arrange ClinicalDataAccessLayer testClinicalAccess = new ClinicalDataAccessLayer(); var postId = 1; int expected = 0; // 0 = not added successfully to DB //act Clinical existingPost = testClinicalAccess.GetClinicalData(postId); var invalidPost = new Clinical(); invalidPost = existingPost; invalidPost.Name = null; invalidPost.WhatIs = null; int returnVal = testClinicalAccess.UpdateClinical(invalidPost); //assert Assert.Equal(expected, returnVal); }
public Clinical GetClinicalData(int id) { return(objclinical.GetClinicalData(id)); }