public void TestGetOfferRequestsById()
        {
            string       expectedEmail = "*****@*****.**";
            var          controller    = new OfferRequestService(carpentryWebsiteContext);
            OfferRequest result        = controller.GetOfferRequestDetails(7);

            Assert.Equal(expectedEmail, result.EmailAddress);
        }
        public void TestDeleteOfferRequests()
        {
            var service = new OfferRequestService(carpentryWebsiteContext);

            service.DeleteOfferRequest(5);
            OfferRequest result = service.GetOfferRequestDetails(5);

            Assert.Null(result);
        }
        public void TestEditOfferRequests()
        {
            string       expectedName = "Different name";
            var          service      = new OfferRequestService(carpentryWebsiteContext);
            OfferRequest itemToAdd    = new OfferRequest {
                OfferRequestId = 17, Name = "New name", EmailAddress = "New email", Message = "New message"
            };

            service.AddOfferRequest(itemToAdd, null, "false");
            carpentryWebsiteContext.Entry(service.GetOfferRequestDetails(17)).State = EntityState.Detached;

            service.UpdateOfferRequest(new OfferRequest {
                OfferRequestId = 17, Name = "Different name", EmailAddress = "Different email", Message = "Different message"
            });
            OfferRequest result = service.GetOfferRequestDetails(17);

            Assert.Equal(expectedName, result.Name);
        }
        public void TestAddOfferRequest()
        {
            var          service   = new OfferRequestService(carpentryWebsiteContext);
            OfferRequest itemToAdd = new OfferRequest {
                OfferRequestId = 105, Name = "New name", EmailAddress = "New email", Message = "New message"
            };

            service.AddOfferRequest(itemToAdd, null, "false");
            OfferRequest result = service.GetOfferRequestDetails(105);

            Assert.Equal(itemToAdd, result);
        }
 public OfferRequest GetOfferRequest(int id)
 {
     return(offerRequestService.GetOfferRequestDetails(id));
 }