Example #1
0
        public void GetClinicalByID_Return_OkResult()
        {
            //arrange
            ClinicalDataAccessLayer testClinicalAccess = new ClinicalDataAccessLayer();
            var postId = 1;


            //act
            Clinical data = testClinicalAccess.GetClinicalData(postId);

            //assert
            Assert.IsType <Clinical>(data);
        }
Example #2
0
        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);
            }
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
        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);
        }
Example #7
0
 public int Edit([FromBody] Clinical clinical)
 {
     return(objclinical.UpdateClinical(clinical));
 }
Example #8
0
 public int Create([FromBody] Clinical clinical)
 {
     return(objclinical.AddClinical(clinical));
 }