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

                    MWQMSampleLanguage mwqmSampleLanguageLast = new MWQMSampleLanguage();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        Query query = new Query();
                        query.Language = LanguageRequest;

                        MWQMSampleLanguageService mwqmSampleLanguageService = new MWQMSampleLanguageService(query, db, ContactID);
                        mwqmSampleLanguageLast = (from c in db.MWQMSampleLanguages select c).FirstOrDefault();
                    }

                    // ok with MWQMSampleLanguage info
                    IHttpActionResult jsonRet = mwqmSampleLanguageController.GetMWQMSampleLanguageWithID(mwqmSampleLanguageLast.MWQMSampleLanguageID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <MWQMSampleLanguage> Ret = jsonRet as OkNegotiatedContentResult <MWQMSampleLanguage>;
                    MWQMSampleLanguage mwqmSampleLanguageRet           = Ret.Content;
                    Assert.AreEqual(mwqmSampleLanguageLast.MWQMSampleLanguageID, mwqmSampleLanguageRet.MWQMSampleLanguageID);

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

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

                    OkNegotiatedContentResult <MWQMSampleLanguage> mwqmSampleLanguageRet2 = jsonRet2 as OkNegotiatedContentResult <MWQMSampleLanguage>;
                    Assert.IsNotNull(mwqmSampleLanguageRet2);

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

                    // Put to return CSSPError because MWQMSampleLanguageID of 0 does not exist
                    mwqmSampleLanguageRet.MWQMSampleLanguageID = 0;
                    IHttpActionResult jsonRet3 = mwqmSampleLanguageController.Put(mwqmSampleLanguageRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    OkNegotiatedContentResult <MWQMSampleLanguage> mwqmSampleLanguageRet3 = jsonRet3 as OkNegotiatedContentResult <MWQMSampleLanguage>;
                    Assert.IsNull(mwqmSampleLanguageRet3);

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

                    MWQMSampleLanguage mwqmSampleLanguageFirst = new MWQMSampleLanguage();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        MWQMSampleLanguageService mwqmSampleLanguageService = new MWQMSampleLanguageService(new Query(), db, ContactID);
                        mwqmSampleLanguageFirst = (from c in db.MWQMSampleLanguages select c).FirstOrDefault();
                    }

                    // ok with MWQMSampleLanguage info
                    IHttpActionResult jsonRet = mwqmSampleLanguageController.GetMWQMSampleLanguageWithID(mwqmSampleLanguageFirst.MWQMSampleLanguageID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <MWQMSampleLanguage> Ret = jsonRet as OkNegotiatedContentResult <MWQMSampleLanguage>;
                    MWQMSampleLanguage mwqmSampleLanguageRet           = Ret.Content;
                    Assert.AreEqual(mwqmSampleLanguageFirst.MWQMSampleLanguageID, mwqmSampleLanguageRet.MWQMSampleLanguageID);

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

                    // Not Found
                    IHttpActionResult jsonRet2 = mwqmSampleLanguageController.GetMWQMSampleLanguageWithID(0);
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <MWQMSampleLanguage> mwqmSampleLanguageRet2 = jsonRet2 as OkNegotiatedContentResult <MWQMSampleLanguage>;
                    Assert.IsNull(mwqmSampleLanguageRet2);

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

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

                        MWQMSampleLanguageService mwqmSampleLanguageService = new MWQMSampleLanguageService(query, db, ContactID);
                        mwqmSampleLanguageLast = (from c in db.MWQMSampleLanguages select c).FirstOrDefault();
                    }

                    // ok with MWQMSampleLanguage info
                    IHttpActionResult jsonRet = mwqmSampleLanguageController.GetMWQMSampleLanguageWithID(mwqmSampleLanguageLast.MWQMSampleLanguageID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <MWQMSampleLanguage> Ret = jsonRet as OkNegotiatedContentResult <MWQMSampleLanguage>;
                    MWQMSampleLanguage mwqmSampleLanguageRet           = Ret.Content;
                    Assert.AreEqual(mwqmSampleLanguageLast.MWQMSampleLanguageID, mwqmSampleLanguageRet.MWQMSampleLanguageID);

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

                    // Post to return CSSPError because MWQMSampleLanguageID exist
                    IHttpActionResult jsonRet2 = mwqmSampleLanguageController.Post(mwqmSampleLanguageRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <MWQMSampleLanguage> mwqmSampleLanguageRet2 = jsonRet2 as OkNegotiatedContentResult <MWQMSampleLanguage>;
                    Assert.IsNull(mwqmSampleLanguageRet2);

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

                    // Post to return newly added MWQMSampleLanguage
                    mwqmSampleLanguageRet.MWQMSampleLanguageID      = 0;
                    mwqmSampleLanguageController.Request            = new System.Net.Http.HttpRequestMessage();
                    mwqmSampleLanguageController.Request.RequestUri = new System.Uri("http://localhost:5000/api/mwqmSampleLanguage");
                    IHttpActionResult jsonRet3 = mwqmSampleLanguageController.Post(mwqmSampleLanguageRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    CreatedNegotiatedContentResult <MWQMSampleLanguage> mwqmSampleLanguageRet3 = jsonRet3 as CreatedNegotiatedContentResult <MWQMSampleLanguage>;
                    Assert.IsNotNull(mwqmSampleLanguageRet3);

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

                    IHttpActionResult jsonRet4 = mwqmSampleLanguageController.Delete(mwqmSampleLanguageRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet4);

                    OkNegotiatedContentResult <MWQMSampleLanguage> mwqmSampleLanguageRet4 = jsonRet4 as OkNegotiatedContentResult <MWQMSampleLanguage>;
                    Assert.IsNotNull(mwqmSampleLanguageRet4);

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