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

                    VPScenario vpScenarioLast = new VPScenario();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        Query query = new Query();
                        query.Language = LanguageRequest;

                        VPScenarioService vpScenarioService = new VPScenarioService(query, db, ContactID);
                        vpScenarioLast = (from c in db.VPScenarios select c).FirstOrDefault();
                    }

                    // ok with VPScenario info
                    IHttpActionResult jsonRet = vpScenarioController.GetVPScenarioWithID(vpScenarioLast.VPScenarioID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <VPScenario> Ret = jsonRet as OkNegotiatedContentResult <VPScenario>;
                    VPScenario vpScenarioRet = Ret.Content;
                    Assert.AreEqual(vpScenarioLast.VPScenarioID, vpScenarioRet.VPScenarioID);

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

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

                    OkNegotiatedContentResult <VPScenario> vpScenarioRet2 = jsonRet2 as OkNegotiatedContentResult <VPScenario>;
                    Assert.IsNotNull(vpScenarioRet2);

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

                    // Put to return CSSPError because VPScenarioID of 0 does not exist
                    vpScenarioRet.VPScenarioID = 0;
                    IHttpActionResult jsonRet3 = vpScenarioController.Put(vpScenarioRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    OkNegotiatedContentResult <VPScenario> vpScenarioRet3 = jsonRet3 as OkNegotiatedContentResult <VPScenario>;
                    Assert.IsNull(vpScenarioRet3);

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

                    VPScenario vpScenarioFirst = new VPScenario();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        VPScenarioService vpScenarioService = new VPScenarioService(new Query(), db, ContactID);
                        vpScenarioFirst = (from c in db.VPScenarios select c).FirstOrDefault();
                    }

                    // ok with VPScenario info
                    IHttpActionResult jsonRet = vpScenarioController.GetVPScenarioWithID(vpScenarioFirst.VPScenarioID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <VPScenario> Ret = jsonRet as OkNegotiatedContentResult <VPScenario>;
                    VPScenario vpScenarioRet = Ret.Content;
                    Assert.AreEqual(vpScenarioFirst.VPScenarioID, vpScenarioRet.VPScenarioID);

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

                    // Not Found
                    IHttpActionResult jsonRet2 = vpScenarioController.GetVPScenarioWithID(0);
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <VPScenario> vpScenarioRet2 = jsonRet2 as OkNegotiatedContentResult <VPScenario>;
                    Assert.IsNull(vpScenarioRet2);

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

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

                        VPScenarioService vpScenarioService = new VPScenarioService(query, db, ContactID);
                        vpScenarioLast = (from c in db.VPScenarios select c).FirstOrDefault();
                    }

                    // ok with VPScenario info
                    IHttpActionResult jsonRet = vpScenarioController.GetVPScenarioWithID(vpScenarioLast.VPScenarioID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <VPScenario> Ret = jsonRet as OkNegotiatedContentResult <VPScenario>;
                    VPScenario vpScenarioRet = Ret.Content;
                    Assert.AreEqual(vpScenarioLast.VPScenarioID, vpScenarioRet.VPScenarioID);

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

                    // Post to return CSSPError because VPScenarioID exist
                    IHttpActionResult jsonRet2 = vpScenarioController.Post(vpScenarioRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <VPScenario> vpScenarioRet2 = jsonRet2 as OkNegotiatedContentResult <VPScenario>;
                    Assert.IsNull(vpScenarioRet2);

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

                    // Post to return newly added VPScenario
                    vpScenarioRet.VPScenarioID              = 0;
                    vpScenarioController.Request            = new System.Net.Http.HttpRequestMessage();
                    vpScenarioController.Request.RequestUri = new System.Uri("http://localhost:5000/api/vpScenario");
                    IHttpActionResult jsonRet3 = vpScenarioController.Post(vpScenarioRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    CreatedNegotiatedContentResult <VPScenario> vpScenarioRet3 = jsonRet3 as CreatedNegotiatedContentResult <VPScenario>;
                    Assert.IsNotNull(vpScenarioRet3);

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

                    IHttpActionResult jsonRet4 = vpScenarioController.Delete(vpScenarioRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet4);

                    OkNegotiatedContentResult <VPScenario> vpScenarioRet4 = jsonRet4 as OkNegotiatedContentResult <VPScenario>;
                    Assert.IsNotNull(vpScenarioRet4);

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