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

                    VPAmbient vpAmbientLast = new VPAmbient();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        Query query = new Query();
                        query.Language = LanguageRequest;

                        VPAmbientService vpAmbientService = new VPAmbientService(query, db, ContactID);
                        vpAmbientLast = (from c in db.VPAmbients select c).FirstOrDefault();
                    }

                    // ok with VPAmbient info
                    IHttpActionResult jsonRet = vpAmbientController.GetVPAmbientWithID(vpAmbientLast.VPAmbientID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <VPAmbient> Ret = jsonRet as OkNegotiatedContentResult <VPAmbient>;
                    VPAmbient vpAmbientRet = Ret.Content;
                    Assert.AreEqual(vpAmbientLast.VPAmbientID, vpAmbientRet.VPAmbientID);

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

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

                    OkNegotiatedContentResult <VPAmbient> vpAmbientRet2 = jsonRet2 as OkNegotiatedContentResult <VPAmbient>;
                    Assert.IsNotNull(vpAmbientRet2);

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

                    // Put to return CSSPError because VPAmbientID of 0 does not exist
                    vpAmbientRet.VPAmbientID = 0;
                    IHttpActionResult jsonRet3 = vpAmbientController.Put(vpAmbientRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    OkNegotiatedContentResult <VPAmbient> vpAmbientRet3 = jsonRet3 as OkNegotiatedContentResult <VPAmbient>;
                    Assert.IsNull(vpAmbientRet3);

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

                    VPAmbient vpAmbientFirst = new VPAmbient();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        VPAmbientService vpAmbientService = new VPAmbientService(new Query(), db, ContactID);
                        vpAmbientFirst = (from c in db.VPAmbients select c).FirstOrDefault();
                    }

                    // ok with VPAmbient info
                    IHttpActionResult jsonRet = vpAmbientController.GetVPAmbientWithID(vpAmbientFirst.VPAmbientID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <VPAmbient> Ret = jsonRet as OkNegotiatedContentResult <VPAmbient>;
                    VPAmbient vpAmbientRet = Ret.Content;
                    Assert.AreEqual(vpAmbientFirst.VPAmbientID, vpAmbientRet.VPAmbientID);

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

                    // Not Found
                    IHttpActionResult jsonRet2 = vpAmbientController.GetVPAmbientWithID(0);
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <VPAmbient> vpAmbientRet2 = jsonRet2 as OkNegotiatedContentResult <VPAmbient>;
                    Assert.IsNull(vpAmbientRet2);

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

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

                        VPAmbientService vpAmbientService = new VPAmbientService(query, db, ContactID);
                        vpAmbientLast = (from c in db.VPAmbients select c).FirstOrDefault();
                    }

                    // ok with VPAmbient info
                    IHttpActionResult jsonRet = vpAmbientController.GetVPAmbientWithID(vpAmbientLast.VPAmbientID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <VPAmbient> Ret = jsonRet as OkNegotiatedContentResult <VPAmbient>;
                    VPAmbient vpAmbientRet = Ret.Content;
                    Assert.AreEqual(vpAmbientLast.VPAmbientID, vpAmbientRet.VPAmbientID);

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

                    // Post to return CSSPError because VPAmbientID exist
                    IHttpActionResult jsonRet2 = vpAmbientController.Post(vpAmbientRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <VPAmbient> vpAmbientRet2 = jsonRet2 as OkNegotiatedContentResult <VPAmbient>;
                    Assert.IsNull(vpAmbientRet2);

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

                    // Post to return newly added VPAmbient
                    vpAmbientRet.VPAmbientID               = 0;
                    vpAmbientController.Request            = new System.Net.Http.HttpRequestMessage();
                    vpAmbientController.Request.RequestUri = new System.Uri("http://localhost:5000/api/vpAmbient");
                    IHttpActionResult jsonRet3 = vpAmbientController.Post(vpAmbientRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    CreatedNegotiatedContentResult <VPAmbient> vpAmbientRet3 = jsonRet3 as CreatedNegotiatedContentResult <VPAmbient>;
                    Assert.IsNotNull(vpAmbientRet3);

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

                    IHttpActionResult jsonRet4 = vpAmbientController.Delete(vpAmbientRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet4);

                    OkNegotiatedContentResult <VPAmbient> vpAmbientRet4 = jsonRet4 as OkNegotiatedContentResult <VPAmbient>;
                    Assert.IsNotNull(vpAmbientRet4);

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