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

                    ContactShortcut contactShortcutLast = new ContactShortcut();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        Query query = new Query();
                        query.Language = LanguageRequest;

                        ContactShortcutService contactShortcutService = new ContactShortcutService(query, db, ContactID);
                        contactShortcutLast = (from c in db.ContactShortcuts select c).FirstOrDefault();
                    }

                    // ok with ContactShortcut info
                    IHttpActionResult jsonRet = contactShortcutController.GetContactShortcutWithID(contactShortcutLast.ContactShortcutID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <ContactShortcut> Ret = jsonRet as OkNegotiatedContentResult <ContactShortcut>;
                    ContactShortcut contactShortcutRet = Ret.Content;
                    Assert.AreEqual(contactShortcutLast.ContactShortcutID, contactShortcutRet.ContactShortcutID);

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

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

                    OkNegotiatedContentResult <ContactShortcut> contactShortcutRet2 = jsonRet2 as OkNegotiatedContentResult <ContactShortcut>;
                    Assert.IsNotNull(contactShortcutRet2);

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

                    // Put to return CSSPError because ContactShortcutID of 0 does not exist
                    contactShortcutRet.ContactShortcutID = 0;
                    IHttpActionResult jsonRet3 = contactShortcutController.Put(contactShortcutRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    OkNegotiatedContentResult <ContactShortcut> contactShortcutRet3 = jsonRet3 as OkNegotiatedContentResult <ContactShortcut>;
                    Assert.IsNull(contactShortcutRet3);

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

                    ContactShortcut contactShortcutFirst = new ContactShortcut();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        ContactShortcutService contactShortcutService = new ContactShortcutService(new Query(), db, ContactID);
                        contactShortcutFirst = (from c in db.ContactShortcuts select c).FirstOrDefault();
                    }

                    // ok with ContactShortcut info
                    IHttpActionResult jsonRet = contactShortcutController.GetContactShortcutWithID(contactShortcutFirst.ContactShortcutID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <ContactShortcut> Ret = jsonRet as OkNegotiatedContentResult <ContactShortcut>;
                    ContactShortcut contactShortcutRet = Ret.Content;
                    Assert.AreEqual(contactShortcutFirst.ContactShortcutID, contactShortcutRet.ContactShortcutID);

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

                    // Not Found
                    IHttpActionResult jsonRet2 = contactShortcutController.GetContactShortcutWithID(0);
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <ContactShortcut> contactShortcutRet2 = jsonRet2 as OkNegotiatedContentResult <ContactShortcut>;
                    Assert.IsNull(contactShortcutRet2);

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

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

                        ContactShortcutService contactShortcutService = new ContactShortcutService(query, db, ContactID);
                        contactShortcutLast = (from c in db.ContactShortcuts select c).FirstOrDefault();
                    }

                    // ok with ContactShortcut info
                    IHttpActionResult jsonRet = contactShortcutController.GetContactShortcutWithID(contactShortcutLast.ContactShortcutID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <ContactShortcut> Ret = jsonRet as OkNegotiatedContentResult <ContactShortcut>;
                    ContactShortcut contactShortcutRet = Ret.Content;
                    Assert.AreEqual(contactShortcutLast.ContactShortcutID, contactShortcutRet.ContactShortcutID);

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

                    // Post to return CSSPError because ContactShortcutID exist
                    IHttpActionResult jsonRet2 = contactShortcutController.Post(contactShortcutRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <ContactShortcut> contactShortcutRet2 = jsonRet2 as OkNegotiatedContentResult <ContactShortcut>;
                    Assert.IsNull(contactShortcutRet2);

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

                    // Post to return newly added ContactShortcut
                    contactShortcutRet.ContactShortcutID         = 0;
                    contactShortcutController.Request            = new System.Net.Http.HttpRequestMessage();
                    contactShortcutController.Request.RequestUri = new System.Uri("http://localhost:5000/api/contactShortcut");
                    IHttpActionResult jsonRet3 = contactShortcutController.Post(contactShortcutRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    CreatedNegotiatedContentResult <ContactShortcut> contactShortcutRet3 = jsonRet3 as CreatedNegotiatedContentResult <ContactShortcut>;
                    Assert.IsNotNull(contactShortcutRet3);

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

                    IHttpActionResult jsonRet4 = contactShortcutController.Delete(contactShortcutRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet4);

                    OkNegotiatedContentResult <ContactShortcut> contactShortcutRet4 = jsonRet4 as OkNegotiatedContentResult <ContactShortcut>;
                    Assert.IsNotNull(contactShortcutRet4);

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