public void GetAll_ServiceRequests_Return_ServiceRequest()
        {
            using (var context = new ServiceRequestContext())
            {
                ServiceRequest sr = GetServiceRequest();

                var controller = new ServiceRequestController(context);
                _ = controller.PostServiceRequest(sr);
                ServiceRequest sr2 = GetServiceRequest();
                sr2.id = new Guid("dadd45b9-d13d-4fd1-9f29-514aa8459e0d");
                List <ServiceRequest> srs = new List <ServiceRequest>();
                srs.Add(sr);
                srs.Add(sr2);
                _ = controller.PostServiceRequest(sr2);
                var results = controller.GetserviceRequests();

                Assert.NotNull(results);
                Assert.NotNull(results.Result);
                Assert.Equal(srs, results.Result.Value);
            }
        }
 public void Get_ServiceRequest_Return_NotFound()
 {
     using (var context = new ServiceRequestContext())
     {
         ServiceRequest sr         = GetServiceRequest();
         var            controller = new ServiceRequestController(context);
         _ = controller.PostServiceRequest(sr);
         var contentStatus = (NotFoundResult)controller.GetServiceRequest(new Guid("dadd45b9-d13d-4fd1-9f29-514aa8459e0d")).Result.Result;
         Assert.NotNull(contentStatus);
         Assert.Equal(404, contentStatus.StatusCode);
     }
 }
        public void Post_ServiceRequest_Return_201()
        {
            using (var context = new ServiceRequestContext())
            {
                ServiceRequest sr = GetServiceRequest();

                var controller = new ServiceRequestController(context);
                var result     = (CreatedAtActionResult)controller.PostServiceRequest(sr).Result.Result;

                Assert.NotNull(result);
                Assert.NotNull(result.StatusCode);
                Assert.Equal(201, result.StatusCode);
            }
        }
 public void Delete_ServiceRequest_Request_Is_Deleted()
 {
     using (var context = new ServiceRequestContext())
     {
         ServiceRequest sr         = GetServiceRequest();
         var            controller = new ServiceRequestController(context);
         _ = controller.PostServiceRequest(sr);
         var result      = controller.DeleteServiceRequest(sr.id);
         var deletedItem = controller.GetServiceRequest(sr.id);
         Assert.NotNull(result);
         Assert.Equal(sr, result.Result.Value);
         Assert.Null(deletedItem.Result.Value);
     }
 }
        public void Get_ServiceRequest_Return_ServiceRequest()
        {
            using (var context = new ServiceRequestContext())
            {
                ServiceRequest sr = GetServiceRequest();

                var controller = new ServiceRequestController(context);
                var result     = controller.PostServiceRequest(sr);
                result = controller.GetServiceRequest(sr.id);

                Assert.NotNull(result);
                Assert.NotNull(result.Result);
                Assert.Equal(sr, result.Result.Value);
            }
        }
        public void Post_ServiceRequest_Return_BadRequest()
        {
            using (var context = new ServiceRequestContext())
            {
                ServiceRequest sr = GetServiceRequest();
                sr.currentStatus = "invalid status";

                var controller = new ServiceRequestController(context);
                var content    = (BadRequestObjectResult)controller.PostServiceRequest(sr).Result.Result;

                Assert.NotNull(content);
                Assert.NotNull(content.StatusCode);
                Assert.Equal(400, content.StatusCode);
            }
        }