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

                    ReportSectionLanguage reportSectionLanguageLast = new ReportSectionLanguage();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        Query query = new Query();
                        query.Language = LanguageRequest;

                        ReportSectionLanguageService reportSectionLanguageService = new ReportSectionLanguageService(query, db, ContactID);
                        reportSectionLanguageLast = (from c in db.ReportSectionLanguages select c).FirstOrDefault();
                    }

                    // ok with ReportSectionLanguage info
                    IHttpActionResult jsonRet = reportSectionLanguageController.GetReportSectionLanguageWithID(reportSectionLanguageLast.ReportSectionLanguageID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <ReportSectionLanguage> Ret = jsonRet as OkNegotiatedContentResult <ReportSectionLanguage>;
                    ReportSectionLanguage reportSectionLanguageRet        = Ret.Content;
                    Assert.AreEqual(reportSectionLanguageLast.ReportSectionLanguageID, reportSectionLanguageRet.ReportSectionLanguageID);

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

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

                    OkNegotiatedContentResult <ReportSectionLanguage> reportSectionLanguageRet2 = jsonRet2 as OkNegotiatedContentResult <ReportSectionLanguage>;
                    Assert.IsNotNull(reportSectionLanguageRet2);

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

                    // Put to return CSSPError because ReportSectionLanguageID of 0 does not exist
                    reportSectionLanguageRet.ReportSectionLanguageID = 0;
                    IHttpActionResult jsonRet3 = reportSectionLanguageController.Put(reportSectionLanguageRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    OkNegotiatedContentResult <ReportSectionLanguage> reportSectionLanguageRet3 = jsonRet3 as OkNegotiatedContentResult <ReportSectionLanguage>;
                    Assert.IsNull(reportSectionLanguageRet3);

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

                    ReportSectionLanguage reportSectionLanguageFirst = new ReportSectionLanguage();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        ReportSectionLanguageService reportSectionLanguageService = new ReportSectionLanguageService(new Query(), db, ContactID);
                        reportSectionLanguageFirst = (from c in db.ReportSectionLanguages select c).FirstOrDefault();
                    }

                    // ok with ReportSectionLanguage info
                    IHttpActionResult jsonRet = reportSectionLanguageController.GetReportSectionLanguageWithID(reportSectionLanguageFirst.ReportSectionLanguageID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <ReportSectionLanguage> Ret = jsonRet as OkNegotiatedContentResult <ReportSectionLanguage>;
                    ReportSectionLanguage reportSectionLanguageRet        = Ret.Content;
                    Assert.AreEqual(reportSectionLanguageFirst.ReportSectionLanguageID, reportSectionLanguageRet.ReportSectionLanguageID);

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

                    // Not Found
                    IHttpActionResult jsonRet2 = reportSectionLanguageController.GetReportSectionLanguageWithID(0);
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <ReportSectionLanguage> reportSectionLanguageRet2 = jsonRet2 as OkNegotiatedContentResult <ReportSectionLanguage>;
                    Assert.IsNull(reportSectionLanguageRet2);

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

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

                        ReportSectionLanguageService reportSectionLanguageService = new ReportSectionLanguageService(query, db, ContactID);
                        reportSectionLanguageLast = (from c in db.ReportSectionLanguages select c).FirstOrDefault();
                    }

                    // ok with ReportSectionLanguage info
                    IHttpActionResult jsonRet = reportSectionLanguageController.GetReportSectionLanguageWithID(reportSectionLanguageLast.ReportSectionLanguageID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <ReportSectionLanguage> Ret = jsonRet as OkNegotiatedContentResult <ReportSectionLanguage>;
                    ReportSectionLanguage reportSectionLanguageRet        = Ret.Content;
                    Assert.AreEqual(reportSectionLanguageLast.ReportSectionLanguageID, reportSectionLanguageRet.ReportSectionLanguageID);

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

                    // Post to return CSSPError because ReportSectionLanguageID exist
                    IHttpActionResult jsonRet2 = reportSectionLanguageController.Post(reportSectionLanguageRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <ReportSectionLanguage> reportSectionLanguageRet2 = jsonRet2 as OkNegotiatedContentResult <ReportSectionLanguage>;
                    Assert.IsNull(reportSectionLanguageRet2);

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

                    // Post to return newly added ReportSectionLanguage
                    reportSectionLanguageRet.ReportSectionLanguageID   = 0;
                    reportSectionLanguageController.Request            = new System.Net.Http.HttpRequestMessage();
                    reportSectionLanguageController.Request.RequestUri = new System.Uri("http://localhost:5000/api/reportSectionLanguage");
                    IHttpActionResult jsonRet3 = reportSectionLanguageController.Post(reportSectionLanguageRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    CreatedNegotiatedContentResult <ReportSectionLanguage> reportSectionLanguageRet3 = jsonRet3 as CreatedNegotiatedContentResult <ReportSectionLanguage>;
                    Assert.IsNotNull(reportSectionLanguageRet3);

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

                    IHttpActionResult jsonRet4 = reportSectionLanguageController.Delete(reportSectionLanguageRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet4);

                    OkNegotiatedContentResult <ReportSectionLanguage> reportSectionLanguageRet4 = jsonRet4 as OkNegotiatedContentResult <ReportSectionLanguage>;
                    Assert.IsNotNull(reportSectionLanguageRet4);

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