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

                    Classification classificationLast = new Classification();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        Query query = new Query();
                        query.Language = LanguageRequest;

                        ClassificationService classificationService = new ClassificationService(query, db, ContactID);
                        classificationLast = (from c in db.Classifications select c).FirstOrDefault();
                    }

                    // ok with Classification info
                    IHttpActionResult jsonRet = classificationController.GetClassificationWithID(classificationLast.ClassificationID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <Classification> Ret = jsonRet as OkNegotiatedContentResult <Classification>;
                    Classification classificationRet = Ret.Content;
                    Assert.AreEqual(classificationLast.ClassificationID, classificationRet.ClassificationID);

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

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

                    OkNegotiatedContentResult <Classification> classificationRet2 = jsonRet2 as OkNegotiatedContentResult <Classification>;
                    Assert.IsNotNull(classificationRet2);

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

                    // Put to return CSSPError because ClassificationID of 0 does not exist
                    classificationRet.ClassificationID = 0;
                    IHttpActionResult jsonRet3 = classificationController.Put(classificationRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    OkNegotiatedContentResult <Classification> classificationRet3 = jsonRet3 as OkNegotiatedContentResult <Classification>;
                    Assert.IsNull(classificationRet3);

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

                    Classification classificationFirst = new Classification();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        ClassificationService classificationService = new ClassificationService(new Query(), db, ContactID);
                        classificationFirst = (from c in db.Classifications select c).FirstOrDefault();
                    }

                    // ok with Classification info
                    IHttpActionResult jsonRet = classificationController.GetClassificationWithID(classificationFirst.ClassificationID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <Classification> Ret = jsonRet as OkNegotiatedContentResult <Classification>;
                    Classification classificationRet = Ret.Content;
                    Assert.AreEqual(classificationFirst.ClassificationID, classificationRet.ClassificationID);

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

                    // Not Found
                    IHttpActionResult jsonRet2 = classificationController.GetClassificationWithID(0);
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <Classification> classificationRet2 = jsonRet2 as OkNegotiatedContentResult <Classification>;
                    Assert.IsNull(classificationRet2);

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

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

                        ClassificationService classificationService = new ClassificationService(query, db, ContactID);
                        classificationLast = (from c in db.Classifications select c).FirstOrDefault();
                    }

                    // ok with Classification info
                    IHttpActionResult jsonRet = classificationController.GetClassificationWithID(classificationLast.ClassificationID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <Classification> Ret = jsonRet as OkNegotiatedContentResult <Classification>;
                    Classification classificationRet = Ret.Content;
                    Assert.AreEqual(classificationLast.ClassificationID, classificationRet.ClassificationID);

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

                    // Post to return CSSPError because ClassificationID exist
                    IHttpActionResult jsonRet2 = classificationController.Post(classificationRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <Classification> classificationRet2 = jsonRet2 as OkNegotiatedContentResult <Classification>;
                    Assert.IsNull(classificationRet2);

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

                    // Post to return newly added Classification
                    classificationRet.ClassificationID          = 0;
                    classificationController.Request            = new System.Net.Http.HttpRequestMessage();
                    classificationController.Request.RequestUri = new System.Uri("http://localhost:5000/api/classification");
                    IHttpActionResult jsonRet3 = classificationController.Post(classificationRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    CreatedNegotiatedContentResult <Classification> classificationRet3 = jsonRet3 as CreatedNegotiatedContentResult <Classification>;
                    Assert.IsNotNull(classificationRet3);

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

                    IHttpActionResult jsonRet4 = classificationController.Delete(classificationRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet4);

                    OkNegotiatedContentResult <Classification> classificationRet4 = jsonRet4 as OkNegotiatedContentResult <Classification>;
                    Assert.IsNotNull(classificationRet4);

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