Ejemplo n.º 1
0
        public void IfWardInfoIsNotThereInsertIcuWardInfo()
        {
            string       icuLayoutUrl = url + "IcuWardInfo";
            IRestClient  restClient   = new RestClient();
            IRestRequest restRequest  = new RestRequest()
            {
                Resource = icuLayoutUrl
            };
            var insertWardInfo = new IcuWardLayoutModel()
            {
                WardNumber     = "1B",
                NumberOfBed    = 30,
                NumberOfRow    = 2,
                NumberOfColumn = 15,
                Department     = "cardiac"
            };

            restRequest.AddHeader("Content-Type", "application/json");
            restRequest.AddJsonBody(insertWardInfo);
            IRestResponse restResponse = restClient.Post(restRequest);

            NUnit.Framework.Assert.AreEqual(restResponse.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            Console.WriteLine(restResponse.StatusCode);
            Console.ReadLine();
        }
 public void AddLayoutInformation(IcuWardLayoutModel objLayout)
 {
     if (objLayout.Department == "radonc")
     {
         throw new Exception("");
     }
 }
        private bool AddBedInIcu(IcuWardLayoutModel objLayout)
        {
            int bedCounter = 1;

            for (int numberOfRow = 1; numberOfRow <= objLayout.NumberOfRow && objLayout.NumberOfBed >= bedCounter; numberOfRow++)
            {
                bedCounter = AddBedInColumn(objLayout, bedCounter, numberOfRow) - 1;
                bedCounter++;
            }
            return(true);
        }
 public IActionResult InsertIcuWardInfo([FromBody] IcuWardLayoutModel objLayoutModel)
 {
     try
     {
         _icuLayoutManagement.AddLayoutInformation(objLayoutModel);
         return(Ok(200));
     }
     catch
     {
         return(StatusCode(500));
     }
 }
 private bool BedLayoutAllocation(IcuWardLayoutModel objLayout)
 {
     try
     {
         bool flag = AddBedInIcu(objLayout);
         return(flag);
     }
     catch
     {
         Console.WriteLine("can not connect to db");
         return(false);
     }
 }
Ejemplo n.º 6
0
        public void TestAddLayoutInformationBedLessThanRowCol()
        {
            var patientLogic = new IcuLayoutBusinessLogic(_repo);
            var objLayout    = new IcuWardLayoutModel
            {
                WardNumber     = "1A1",
                NumberOfBed    = 1,
                Department     = "cancer",
                NumberOfColumn = 2,
                NumberOfRow    = 5
            };

            patientLogic.AddLayoutInformation(objLayout);
        }
        public void AddLayoutInformation(IcuWardLayoutModel objLayout)
        {
            var icuLayout = new IcuWardInformation
            {
                Department = objLayout.Department,
                WardNumber = objLayout.WardNumber,
                TotalBed   = objLayout.NumberOfBed
            };
            bool isBedLayoutIsEnterInDatabase = BedLayoutAllocation(objLayout);

            if (isBedLayoutIsEnterInDatabase == false)
            {
                Console.WriteLine("Bed are not entered for ward " + objLayout.WardNumber);
            }
            _icuLayoutDataRepository.InsertLayout(icuLayout);
        }
 private int AddBedInColumn(IcuWardLayoutModel objLayout, int bedCounter, int numberOfRow)
 {
     for (int numberOfColumn = 1; numberOfColumn <= objLayout.NumberOfColumn && objLayout.NumberOfBed >= bedCounter; numberOfColumn++)
     {
         var bedId   = string.Concat(objLayout.WardNumber, bedCounter.ToString());
         var bedInfo = new BedInformation
         {
             BedId       = bedId,
             BedInColumn = numberOfColumn,
             BedInRow    = numberOfRow,
             WardNumber  = objLayout.WardNumber
         };
         _icuLayoutDataRepository.InsertBed(bedInfo);
         bedCounter++;
     }
     return(bedCounter);
 }
Ejemplo n.º 9
0
        public void TestInsertIcuWardInfoUnSuccessful()
        {
            var controller           = new IcuLayoutController(_repo);
            IcuWardLayoutModel model = new IcuWardLayoutModel
            {
                Department     = "radonc",
                NumberOfBed    = 2,
                NumberOfColumn = 2,
                NumberOfRow    = 1,
                WardNumber     = "1A1"
            };
            var actualResponse       = controller.InsertIcuWardInfo(model);
            var actualResponseObject = actualResponse as StatusCodeResult;

            Assert.NotNull(actualResponseObject);
            Assert.Equal(500, actualResponseObject.StatusCode);
        }
Ejemplo n.º 10
0
        public void IfWardInfoIsThereInsertIcuWardInfo()
        {
            string       icuLayoutUrl = url + "/IcuWardInfo";
            IRestClient  restClient   = new RestClient();
            IRestRequest restRequest  = new RestRequest()
            {
                Resource = icuLayoutUrl
            };
            var insertWardInfo = new IcuWardLayoutModel()
            {
                WardNumber     = "1E",
                NumberOfBed    = 30,
                NumberOfRow    = 2,
                NumberOfColumn = 15,
                Department     = "cardiac"
            };

            restRequest.AddHeader("Content-Type", "application/json");
            restRequest.AddJsonBody(insertWardInfo);
            IRestResponse restResponse = restClient.Post(restRequest);

            Console.WriteLine(restResponse.StatusCode);
            Assert.AreEqual(restResponse.StatusCode, HttpStatusCode.InternalServerError);
        }