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

                    MapInfoPoint mapInfoPointLast = new MapInfoPoint();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        Query query = new Query();
                        query.Language = LanguageRequest;

                        MapInfoPointService mapInfoPointService = new MapInfoPointService(query, db, ContactID);
                        mapInfoPointLast = (from c in db.MapInfoPoints select c).FirstOrDefault();
                    }

                    // ok with MapInfoPoint info
                    IHttpActionResult jsonRet = mapInfoPointController.GetMapInfoPointWithID(mapInfoPointLast.MapInfoPointID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <MapInfoPoint> Ret = jsonRet as OkNegotiatedContentResult <MapInfoPoint>;
                    MapInfoPoint mapInfoPointRet = Ret.Content;
                    Assert.AreEqual(mapInfoPointLast.MapInfoPointID, mapInfoPointRet.MapInfoPointID);

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

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

                    OkNegotiatedContentResult <MapInfoPoint> mapInfoPointRet2 = jsonRet2 as OkNegotiatedContentResult <MapInfoPoint>;
                    Assert.IsNotNull(mapInfoPointRet2);

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

                    // Put to return CSSPError because MapInfoPointID of 0 does not exist
                    mapInfoPointRet.MapInfoPointID = 0;
                    IHttpActionResult jsonRet3 = mapInfoPointController.Put(mapInfoPointRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    OkNegotiatedContentResult <MapInfoPoint> mapInfoPointRet3 = jsonRet3 as OkNegotiatedContentResult <MapInfoPoint>;
                    Assert.IsNull(mapInfoPointRet3);

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

                    MapInfoPoint mapInfoPointFirst = new MapInfoPoint();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        MapInfoPointService mapInfoPointService = new MapInfoPointService(new Query(), db, ContactID);
                        mapInfoPointFirst = (from c in db.MapInfoPoints select c).FirstOrDefault();
                    }

                    // ok with MapInfoPoint info
                    IHttpActionResult jsonRet = mapInfoPointController.GetMapInfoPointWithID(mapInfoPointFirst.MapInfoPointID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <MapInfoPoint> Ret = jsonRet as OkNegotiatedContentResult <MapInfoPoint>;
                    MapInfoPoint mapInfoPointRet = Ret.Content;
                    Assert.AreEqual(mapInfoPointFirst.MapInfoPointID, mapInfoPointRet.MapInfoPointID);

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

                    // Not Found
                    IHttpActionResult jsonRet2 = mapInfoPointController.GetMapInfoPointWithID(0);
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <MapInfoPoint> mapInfoPointRet2 = jsonRet2 as OkNegotiatedContentResult <MapInfoPoint>;
                    Assert.IsNull(mapInfoPointRet2);

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

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

                        MapInfoPointService mapInfoPointService = new MapInfoPointService(query, db, ContactID);
                        mapInfoPointLast = (from c in db.MapInfoPoints select c).FirstOrDefault();
                    }

                    // ok with MapInfoPoint info
                    IHttpActionResult jsonRet = mapInfoPointController.GetMapInfoPointWithID(mapInfoPointLast.MapInfoPointID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <MapInfoPoint> Ret = jsonRet as OkNegotiatedContentResult <MapInfoPoint>;
                    MapInfoPoint mapInfoPointRet = Ret.Content;
                    Assert.AreEqual(mapInfoPointLast.MapInfoPointID, mapInfoPointRet.MapInfoPointID);

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

                    // Post to return CSSPError because MapInfoPointID exist
                    IHttpActionResult jsonRet2 = mapInfoPointController.Post(mapInfoPointRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <MapInfoPoint> mapInfoPointRet2 = jsonRet2 as OkNegotiatedContentResult <MapInfoPoint>;
                    Assert.IsNull(mapInfoPointRet2);

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

                    // Post to return newly added MapInfoPoint
                    mapInfoPointRet.MapInfoPointID            = 0;
                    mapInfoPointController.Request            = new System.Net.Http.HttpRequestMessage();
                    mapInfoPointController.Request.RequestUri = new System.Uri("http://localhost:5000/api/mapInfoPoint");
                    IHttpActionResult jsonRet3 = mapInfoPointController.Post(mapInfoPointRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet3);

                    CreatedNegotiatedContentResult <MapInfoPoint> mapInfoPointRet3 = jsonRet3 as CreatedNegotiatedContentResult <MapInfoPoint>;
                    Assert.IsNotNull(mapInfoPointRet3);

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

                    IHttpActionResult jsonRet4 = mapInfoPointController.Delete(mapInfoPointRet, LanguageRequest.ToString());
                    Assert.IsNotNull(jsonRet4);

                    OkNegotiatedContentResult <MapInfoPoint> mapInfoPointRet4 = jsonRet4 as OkNegotiatedContentResult <MapInfoPoint>;
                    Assert.IsNotNull(mapInfoPointRet4);

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