public void LabSheetDetail_Controller_Put_Test()
        {
            foreach (LanguageEnum LanguageRequest in AllowableLanguages)
            {
                foreach (int ContactID in new List <int>()
                {
                    AdminContactID
                })                                                             //, TestEmailValidatedContactID, TestEmailNotValidatedContactID })
                {
                    LabSheetDetailController labSheetDetailController = new LabSheetDetailController(DatabaseTypeEnum.SqlServerTestDB);
                    Assert.IsNotNull(labSheetDetailController);
                    Assert.AreEqual(DatabaseTypeEnum.SqlServerTestDB, labSheetDetailController.DatabaseType);

                    LabSheetDetail labSheetDetailLast = new LabSheetDetail();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        Query query = new Query();
                        query.Language = LanguageRequest;

                        LabSheetDetailService labSheetDetailService = new LabSheetDetailService(query, db, ContactID);
                        labSheetDetailLast = (from c in db.LabSheetDetails select c).FirstOrDefault();
                    }

                    // ok with LabSheetDetail info
                    IHttpActionResult jsonRet = labSheetDetailController.GetLabSheetDetailWithID(labSheetDetailLast.LabSheetDetailID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <LabSheetDetail> Ret = jsonRet as OkNegotiatedContentResult <LabSheetDetail>;
                    LabSheetDetail labSheetDetailRet = Ret.Content;
                    Assert.AreEqual(labSheetDetailLast.LabSheetDetailID, labSheetDetailRet.LabSheetDetailID);

                    BadRequestErrorMessageResult badRequest = jsonRet as BadRequestErrorMessageResult;
                    Assert.IsNull(badRequest);

                    // Put to return success
                    IHttpActionResult jsonRet2 = labSheetDetailController.Put(labSheetDetailRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <LabSheetDetail> labSheetDetailRet2 = jsonRet2 as OkNegotiatedContentResult <LabSheetDetail>;
                    Assert.IsNotNull(labSheetDetailRet2);

                    BadRequestErrorMessageResult badRequest2 = jsonRet2 as BadRequestErrorMessageResult;
                    Assert.IsNull(badRequest2);

                    // Put to return CSSPError because LabSheetDetailID of 0 does not exist
                    labSheetDetailRet.LabSheetDetailID = 0;
                    IHttpActionResult jsonRet3 = labSheetDetailController.Put(labSheetDetailRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    OkNegotiatedContentResult <LabSheetDetail> labSheetDetailRet3 = jsonRet3 as OkNegotiatedContentResult <LabSheetDetail>;
                    Assert.IsNull(labSheetDetailRet3);

                    BadRequestErrorMessageResult badRequest3 = jsonRet3 as BadRequestErrorMessageResult;
                    Assert.IsNotNull(badRequest3);
                }
            }
        }
        public void LabSheetDetail_Controller_GetLabSheetDetailWithID_Test()
        {
            foreach (LanguageEnum LanguageRequest in AllowableLanguages)
            {
                foreach (int ContactID in new List <int>()
                {
                    AdminContactID
                })                                                             //, TestEmailValidatedContactID, TestEmailNotValidatedContactID })
                {
                    LabSheetDetailController labSheetDetailController = new LabSheetDetailController(DatabaseTypeEnum.SqlServerTestDB);
                    Assert.IsNotNull(labSheetDetailController);
                    Assert.AreEqual(DatabaseTypeEnum.SqlServerTestDB, labSheetDetailController.DatabaseType);

                    LabSheetDetail labSheetDetailFirst = new LabSheetDetail();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        LabSheetDetailService labSheetDetailService = new LabSheetDetailService(new Query(), db, ContactID);
                        labSheetDetailFirst = (from c in db.LabSheetDetails select c).FirstOrDefault();
                    }

                    // ok with LabSheetDetail info
                    IHttpActionResult jsonRet = labSheetDetailController.GetLabSheetDetailWithID(labSheetDetailFirst.LabSheetDetailID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <LabSheetDetail> Ret = jsonRet as OkNegotiatedContentResult <LabSheetDetail>;
                    LabSheetDetail labSheetDetailRet = Ret.Content;
                    Assert.AreEqual(labSheetDetailFirst.LabSheetDetailID, labSheetDetailRet.LabSheetDetailID);

                    BadRequestErrorMessageResult badRequest = jsonRet as BadRequestErrorMessageResult;
                    Assert.IsNull(badRequest);

                    // Not Found
                    IHttpActionResult jsonRet2 = labSheetDetailController.GetLabSheetDetailWithID(0);
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <LabSheetDetail> labSheetDetailRet2 = jsonRet2 as OkNegotiatedContentResult <LabSheetDetail>;
                    Assert.IsNull(labSheetDetailRet2);

                    NotFoundResult notFoundRequest = jsonRet2 as NotFoundResult;
                    Assert.IsNotNull(notFoundRequest);
                }
            }
        }
        public void LabSheetDetail_Controller_Post_Test()
        {
            foreach (LanguageEnum LanguageRequest in AllowableLanguages)
            {
                foreach (int ContactID in new List <int>()
                {
                    AdminContactID
                })                                                             //, TestEmailValidatedContactID, TestEmailNotValidatedContactID })
                {
                    LabSheetDetailController labSheetDetailController = new LabSheetDetailController(DatabaseTypeEnum.SqlServerTestDB);
                    Assert.IsNotNull(labSheetDetailController);
                    Assert.AreEqual(DatabaseTypeEnum.SqlServerTestDB, labSheetDetailController.DatabaseType);

                    LabSheetDetail labSheetDetailLast = new LabSheetDetail();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        Query query = new Query();
                        query.Language = LanguageRequest;
                        query.Asc      = "";
                        query.Desc     = "";

                        LabSheetDetailService labSheetDetailService = new LabSheetDetailService(query, db, ContactID);
                        labSheetDetailLast = (from c in db.LabSheetDetails select c).FirstOrDefault();
                    }

                    // ok with LabSheetDetail info
                    IHttpActionResult jsonRet = labSheetDetailController.GetLabSheetDetailWithID(labSheetDetailLast.LabSheetDetailID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <LabSheetDetail> Ret = jsonRet as OkNegotiatedContentResult <LabSheetDetail>;
                    LabSheetDetail labSheetDetailRet = Ret.Content;
                    Assert.AreEqual(labSheetDetailLast.LabSheetDetailID, labSheetDetailRet.LabSheetDetailID);

                    BadRequestErrorMessageResult badRequest = jsonRet as BadRequestErrorMessageResult;
                    Assert.IsNull(badRequest);

                    // Post to return CSSPError because LabSheetDetailID exist
                    IHttpActionResult jsonRet2 = labSheetDetailController.Post(labSheetDetailRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <LabSheetDetail> labSheetDetailRet2 = jsonRet2 as OkNegotiatedContentResult <LabSheetDetail>;
                    Assert.IsNull(labSheetDetailRet2);

                    BadRequestErrorMessageResult badRequest2 = jsonRet2 as BadRequestErrorMessageResult;
                    Assert.IsNotNull(badRequest2);

                    // Post to return newly added LabSheetDetail
                    labSheetDetailRet.LabSheetDetailID          = 0;
                    labSheetDetailController.Request            = new System.Net.Http.HttpRequestMessage();
                    labSheetDetailController.Request.RequestUri = new System.Uri("http://localhost:5000/api/labSheetDetail");
                    IHttpActionResult jsonRet3 = labSheetDetailController.Post(labSheetDetailRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    CreatedNegotiatedContentResult <LabSheetDetail> labSheetDetailRet3 = jsonRet3 as CreatedNegotiatedContentResult <LabSheetDetail>;
                    Assert.IsNotNull(labSheetDetailRet3);

                    BadRequestErrorMessageResult badRequest3 = jsonRet3 as BadRequestErrorMessageResult;
                    Assert.IsNull(badRequest3);

                    IHttpActionResult jsonRet4 = labSheetDetailController.Delete(labSheetDetailRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet4);

                    OkNegotiatedContentResult <LabSheetDetail> labSheetDetailRet4 = jsonRet4 as OkNegotiatedContentResult <LabSheetDetail>;
                    Assert.IsNotNull(labSheetDetailRet4);

                    BadRequestErrorMessageResult badRequest4 = jsonRet4 as BadRequestErrorMessageResult;
                    Assert.IsNull(badRequest4);
                }
            }
        }