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 AddInvalidData_Return_BadRquest() { //arrange ClinicalDataAccessLayer testClinicalAccess = new ClinicalDataAccessLayer(); Clinical data = new Clinical() { WhatIs = null }; int expected = 0; // 0 = not added successfully to DB //act int result = testClinicalAccess.AddClinical(data); //assert Assert.Equal(expected, result); }
public void AddValidData_Return_OkResult() { //arrange ClinicalDataAccessLayer testClinicalAccess = new ClinicalDataAccessLayer(); Clinical data = new Clinical() { Name = "Test Name", WhatIs = "Test What Is" }; int expected = 1; //1 = successfully added to DB //act int result = testClinicalAccess.AddClinical(data); //assert Assert.Equal(expected, result); }
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 int Edit([FromBody] Clinical clinical) { return(objclinical.UpdateClinical(clinical)); }
public int Create([FromBody] Clinical clinical) { return(objclinical.AddClinical(clinical)); }