Exemplo n.º 1
0
        public SpillModel AddSpillModel()
        {
            TVItemModel tvItemModelMunicipality = randomService.RandomTVItem(TVTypeEnum.Municipality);

            Assert.AreEqual("", tvItemModelMunicipality.Error);

            TVItemModel tvItemModelInfrastructure = randomService.RandomTVItem(TVTypeEnum.Infrastructure);

            Assert.AreEqual("", tvItemModelInfrastructure.Error);

            spillModelNew.MunicipalityTVItemID   = tvItemModelMunicipality.TVItemID;
            spillModelNew.InfrastructureTVItemID = tvItemModelInfrastructure.TVItemID;
            FillSpillModel(spillModelNew);

            SpillModel spillModelRet = spillService.PostAddSpillDB(spillModelNew);

            if (!string.IsNullOrWhiteSpace(spillModelRet.Error))
            {
                return(spillModelRet);
            }

            CompareSpillModels(spillModelNew, spillModelRet);

            return(spillModelRet);
        }
Exemplo n.º 2
0
        public void SpillService_PostUpdateSpill_GetSpillWithSpillIDDB_Error_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = AddSpillModel();

                    using (ShimsContext.Create())
                    {
                        SetupShim();
                        //string ErrorText = "ErrorText";
                        shimSpillService.GetSpillWithSpillIDDBInt32 = (a) =>
                        {
                            return(null);
                        };

                        SpillModel spillModelRet2 = UpdateSpillModel(spillModelRet);
                        Assert.AreEqual(string.Format(ServiceRes.CouldNotFind_ToUpdate, ServiceRes.Spill), spillModelRet2.Error);
                    }
                }
            }
        }
Exemplo n.º 3
0
        public SpillModel GetSpillModelWithSpillIDDB(int SpillID)
        {
            SpillModel spillModel = (from c in db.Spills
                                     let muniName = (from cl in db.TVItemLanguages where cl.Language == (int)LanguageRequest && cl.TVItemID == c.MunicipalityTVItemID select cl.TVText).FirstOrDefault <string>()
                                                    let infrastructureName = (from cl in db.TVItemLanguages where cl.Language == (int)LanguageRequest && cl.TVItemID == c.InfrastructureTVItemID select cl.TVText).FirstOrDefault <string>()
                                                                             let spillComment = (from cl in db.SpillLanguages where cl.Language == (int)LanguageRequest && cl.SpillID == c.SpillID select cl.SpillComment).FirstOrDefault <string>()
                                                                                                where c.SpillID == SpillID
                                                                                                select new SpillModel
            {
                Error = "",
                SpillID = c.SpillID,
                DBCommand = (DBCommandEnum)c.DBCommand,
                SpillComment = spillComment,
                MunicipalityTVItemID = c.MunicipalityTVItemID,
                MunicipalityTVText = muniName,
                InfrastructureTVItemID = c.InfrastructureTVItemID,
                InfrastructureTVText = infrastructureName,
                AverageFlow_m3_day = c.AverageFlow_m3_day,
                EndDateTime_Local = c.EndDateTime_Local,
                StartDateTime_Local = c.StartDateTime_Local,
                LastUpdateDate_UTC = c.LastUpdateDate_UTC,
                LastUpdateContactTVItemID = c.LastUpdateContactTVItemID,
            }).FirstOrDefault <SpillModel>();

            if (spillModel == null)
            {
                return(ReturnError(string.Format(ServiceRes.CouldNotFind_With_Equal_, ServiceRes.Spill, ServiceRes.SpillID, SpillID)));
            }

            return(spillModel);
        }
Exemplo n.º 4
0
        public void SpillService_PostAddSpillDB_GetTVItemModelWithTVItemIDDB_Error_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    using (ShimsContext.Create())
                    {
                        SetupShim();
                        string ErrorText = "ErrorText";
                        shimTVItemService.GetTVItemModelWithTVItemIDDBInt32 = (a) =>
                        {
                            return(new TVItemModel()
                            {
                                Error = ErrorText
                            });
                        };

                        SpillModel spillModelRet = AddSpillModel();
                        Assert.AreEqual(ErrorText, spillModelRet.Error);
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void SpillLanguageService_FillSpillLanguage_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = spillServiceTest.AddSpillModel();

                    LanguageEnum LangToAdd = LanguageEnum.es;

                    FillSpillLanguageModelNew(LangToAdd, spillModelRet, spillLanguageModelNew);

                    ContactOK contactOK = spillLanguageService.IsContactOK();

                    string retStr = spillLanguageService.FillSpillLanguage(spillLanguage, spillLanguageModelNew, contactOK);
                    Assert.AreEqual("", retStr);
                    Assert.AreEqual(contactOK.ContactTVItemID, spillLanguage.LastUpdateContactTVItemID);

                    contactOK = null;

                    retStr = spillLanguageService.FillSpillLanguage(spillLanguage, spillLanguageModelNew, contactOK);
                    Assert.AreEqual("", retStr);
                    Assert.AreEqual(2, spillLanguage.LastUpdateContactTVItemID);
                }
            }
        }
Exemplo n.º 6
0
        public void SpillLanguageService_PostAddSpillLanguageDB_Add_Error_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = spillServiceTest.AddSpillModel();

                    using (ShimsContext.Create())
                    {
                        SetupShim();
                        LanguageEnum LangToAdd = LanguageEnum.es;
                        FillSpillLanguageModelNew(LangToAdd, spillModelRet, spillLanguageModelNew);

                        //string ErrorText = "ErrorText";
                        shimSpillLanguageService.FillSpillLanguageSpillLanguageSpillLanguageModelContactOK = (a, b, c) =>
                        {
                            return("");
                        };

                        SpillLanguageModel spillLanguageModelRet = spillLanguageService.PostAddSpillLanguageDB(spillLanguageModelNew);
                        Assert.IsTrue(spillLanguageModelRet.Error.StartsWith(string.Format(ServiceRes.CouldNotAddError_, "").Substring(0, 10)));
                    }
                }
            }
        }
Exemplo n.º 7
0
        public void SpillLanguageService_PostAddSpillLanguageDB_SpillModelOK_Error_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    using (ShimsContext.Create())
                    {
                        SpillModel spillModelRet = spillServiceTest.AddSpillModel();

                        LanguageEnum LangToAdd = LanguageEnum.es;
                        FillSpillLanguageModelNew(LangToAdd, spillModelRet, spillLanguageModelNew);

                        string ErrorText = "ErrorText";
                        ShimSpillLanguageService shimSpillLanguageService = new ShimSpillLanguageService(spillLanguageService);
                        shimSpillLanguageService.SpillLanguageModelOKSpillLanguageModel = (a) =>
                        {
                            return(ErrorText);
                        };

                        SpillLanguageModel spillLanguageModelRet = spillLanguageService.PostAddSpillLanguageDB(spillLanguageModelNew);
                        Assert.AreEqual(ErrorText, spillLanguageModelRet.Error);
                    }
                }
            }
        }
Exemplo n.º 8
0
        public void SpillLanguageService_PostDeleteSpillLanguageDB_IsContactOK_Error_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = spillServiceTest.AddSpillModel();

                    LanguageEnum LangToAdd = LanguageEnum.es;

                    SpillLanguageModel spillLanguageModelRet = AddSpillLanguageModel(LangToAdd, spillModelRet);

                    SpillLanguageModel spillLanguageModelRet2 = UpdateSpillLanguageModel(spillLanguageModelRet);

                    using (ShimsContext.Create())
                    {
                        SetupShim();
                        string ErrorText = "ErrorText";
                        shimSpillLanguageService.IsContactOK = () =>
                        {
                            return(new ContactOK()
                            {
                                Error = ErrorText
                            });
                        };

                        SpillLanguageModel spillLanguageModelRet3 = spillLanguageService.PostDeleteSpillLanguageDB(spillLanguageModelRet2.SpillID, LangToAdd);
                        Assert.AreEqual(ErrorText, spillLanguageModelRet3.Error);
                    }
                }
            }
        }
Exemplo n.º 9
0
        public void SpillLanguageService_PostUpdateSpillLanguageDB_GetSpillLanguageWithSpillIDAndLanguageDB_Error_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = spillServiceTest.AddSpillModel();

                    LanguageEnum LangToAdd = LanguageEnum.es;

                    SpillLanguageModel spillLanguageModelRet = AddSpillLanguageModel(LangToAdd, spillModelRet);

                    using (ShimsContext.Create())
                    {
                        SetupShim();
                        FillSpillLanguageModelUpdate(spillLanguageModelRet);

                        //string ErrorText = "ErrorText";
                        shimSpillLanguageService.GetSpillLanguageWithSpillIDAndLanguageDBInt32LanguageEnum = (a, b) =>
                        {
                            return(null);
                        };

                        SpillLanguageModel spillLanguageModelRet2 = spillLanguageService.PostUpdateSpillLanguageDB(spillLanguageModelRet);
                        Assert.AreEqual(string.Format(ServiceRes.CouldNotFind_ToUpdate, ServiceRes.SpillLanguage), spillLanguageModelRet2.Error);
                    }
                }
            }
        }
Exemplo n.º 10
0
        public void SpillLanguageService_PostUpdateSpillLanguageDB_DoUpdateChanges_Error_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = spillServiceTest.AddSpillModel();

                    LanguageEnum LangToAdd = LanguageEnum.es;

                    SpillLanguageModel spillLanguageModelRet = AddSpillLanguageModel(LangToAdd, spillModelRet);

                    using (ShimsContext.Create())
                    {
                        SetupShim();
                        FillSpillLanguageModelUpdate(spillLanguageModelRet);

                        string ErrorText = "ErrorText";
                        shimSpillLanguageService.DoUpdateChanges = () =>
                        {
                            return(ErrorText);
                        };

                        SpillLanguageModel spillLanguageModelRet2 = spillLanguageService.PostUpdateSpillLanguageDB(spillLanguageModelRet);
                        Assert.AreEqual(ErrorText, spillLanguageModelRet2.Error);
                    }
                }
            }
        }
Exemplo n.º 11
0
        public void SpillService_PostDeleteSpill_DoDeleteChanges_Error_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = AddSpillModel();

                    using (ShimsContext.Create())
                    {
                        SetupShim();
                        string ErrorText = "ErrorText";
                        shimSpillService.DoDeleteChanges = () =>
                        {
                            return(ErrorText);
                        };

                        SpillModel spillModelRet2 = spillService.PostDeleteSpillDB(spillModelRet.SpillID);
                        Assert.AreEqual(ErrorText, spillModelRet2.Error);
                    }
                }
            }
        }
Exemplo n.º 12
0
        public void SpillService_PostUpdateSpill_PostUpdateSpillLanguageDB_Error_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = AddSpillModel();

                    using (ShimsContext.Create())
                    {
                        SetupShim();
                        string ErrorText = "ErrorText";
                        shimSpillLanguageService.PostUpdateSpillLanguageDBSpillLanguageModel = (a) =>
                        {
                            return(new SpillLanguageModel()
                            {
                                Error = ErrorText
                            });
                        };

                        SpillModel spillModelRet2 = UpdateSpillModel(spillModelRet);
                        Assert.AreEqual(ErrorText, spillModelRet2.Error);
                    }
                }
            }
        }
Exemplo n.º 13
0
        public Spill GetSpillExistDB(SpillModel spillModel)
        {
            Spill spill = (from c in db.Spills
                           where c.MunicipalityTVItemID == spillModel.MunicipalityTVItemID &&
                           c.InfrastructureTVItemID == spillModel.InfrastructureTVItemID &&
                           c.StartDateTime_Local == spillModel.StartDateTime_Local
                           select c).FirstOrDefault <Spill>();

            return(spill);
        }
Exemplo n.º 14
0
        private void FillSpillLanguageModelNew(LanguageEnum Language, SpillModel spillModel, SpillLanguageModel spillLanguageModel)
        {
            spillLanguageModel.SpillID           = spillModel.SpillID;
            spillLanguageModel.SpillComment      = randomService.RandomString("SpillName", 30);
            spillLanguageModel.Language          = Language;
            spillLanguageModel.TranslationStatus = TranslationStatusEnum.Translated;

            Assert.IsTrue(spillLanguageModel.SpillID != 0);
            Assert.IsTrue(spillLanguageModel.SpillComment.Length == 30);
            Assert.IsTrue(spillLanguageModel.Language == Language);
            Assert.IsTrue(spillLanguageModel.TranslationStatus == TranslationStatusEnum.Translated);
        }
Exemplo n.º 15
0
        public void SpillService_ReturnError_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    string     ErrorText     = "ErrorText";
                    SpillModel spillModelRet = spillService.ReturnError(ErrorText);
                    Assert.AreEqual(ErrorText, spillModelRet.Error);
                }
            }
        }
Exemplo n.º 16
0
        public void SetupTest(ContactModel contactModelToDo, CultureInfo culture)
        {
            Thread.CurrentThread.CurrentCulture   = culture;
            Thread.CurrentThread.CurrentUICulture = culture;

            contactModel         = contactModelToDo;
            user                 = new GenericPrincipal(new GenericIdentity(contactModel.LoginEmail, "Forms"), null);
            spillService         = new SpillService((culture.TwoLetterISOLanguageName == "fr" ? LanguageEnum.fr : LanguageEnum.en), user);
            spillLanguageService = new SpillLanguageService((culture.TwoLetterISOLanguageName == "fr" ? LanguageEnum.fr : LanguageEnum.en), user);
            testDBService        = new TestDBService((culture.TwoLetterISOLanguageName == "fr" ? LanguageEnum.fr : LanguageEnum.en), user, TableName, Plurial);
            randomService        = new RandomService((culture.TwoLetterISOLanguageName == "fr" ? LanguageEnum.fr : LanguageEnum.en), user);
            spillModelNew        = new SpillModel();
            spill                = new Spill();
        }
Exemplo n.º 17
0
        public void SpillService_PostAddSpillDB_BadUser_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListBad[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = AddSpillModel();
                    Assert.IsNotNull(spillModelRet);
                    Assert.AreEqual(ServiceRes.NeedToBeLoggedIn, spillModelRet.Error);
                }
            }
        }
Exemplo n.º 18
0
        public void SpillService_PostAddSpillDB_UserEmailNotValidated_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[2], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = AddSpillModel();
                    Assert.IsNotNull(spillModelRet);
                    Assert.AreEqual(ServiceRes.EmailRequiresValidation, spillModelRet.Error);
                }
            }
        }
Exemplo n.º 19
0
        // Check
        public string SpillModelOK(SpillModel spillModel)
        {
            string retStr = FieldCheckNotZeroInt(spillModel.MunicipalityTVItemID, ServiceRes.MunicipalityTVItemID);

            if (!string.IsNullOrWhiteSpace(retStr))
            {
                return(retStr);
            }

            retStr = FieldCheckIfNotNullNotZeroInt(spillModel.InfrastructureTVItemID, ServiceRes.InfrastructureTVItemID);
            if (!string.IsNullOrWhiteSpace(retStr))
            {
                return(retStr);
            }

            retStr = FieldCheckIfNotNullMaxLengthString(spillModel.SpillComment, ServiceRes.SpillComment, 10000);
            if (!string.IsNullOrWhiteSpace(retStr))
            {
                return(retStr);
            }

            retStr = FieldCheckNotNullDateTime(spillModel.StartDateTime_Local, ServiceRes.StartDateTime_Local);
            if (!string.IsNullOrWhiteSpace(retStr))
            {
                return(retStr);
            }

            if (spillModel.EndDateTime_Local != null)
            {
                if (spillModel.StartDateTime_Local > spillModel.EndDateTime_Local)
                {
                    return(string.Format(ServiceRes._IsLaterThan_, ServiceRes.StartDateTime_Local, ServiceRes.EndDateTime_Local));
                }
            }

            retStr = FieldCheckNotNullAndWithinRangeDouble(spillModel.AverageFlow_m3_day, ServiceRes.AverageFlow_m3_day, 1, 100000);
            if (!string.IsNullOrWhiteSpace(retStr))
            {
                return(retStr);
            }

            retStr = _BaseEnumService.DBCommandOK(spillModel.DBCommand);
            if (!string.IsNullOrWhiteSpace(retStr))
            {
                return(retStr);
            }

            return("");
        }
Exemplo n.º 20
0
        public SpillModel UpdateSpillModel(SpillModel spillModel)
        {
            FillSpillModel(spillModel);

            SpillModel spillModelRet2 = spillService.PostUpdateSpillDB(spillModel);

            if (!string.IsNullOrWhiteSpace(spillModelRet2.Error))
            {
                return(spillModelRet2);
            }

            CompareSpillModels(spillModel, spillModelRet2);

            return(spillModelRet2);
        }
Exemplo n.º 21
0
 private void FillSpillModel(SpillModel spillModel)
 {
     spillModel.SpillComment           = randomService.RandomString("", 50);
     spillModel.MunicipalityTVItemID   = spillModel.MunicipalityTVItemID;
     spillModel.InfrastructureTVItemID = spillModel.InfrastructureTVItemID;
     spillModel.StartDateTime_Local    = randomService.RandomDateTime();
     spillModel.EndDateTime_Local      = spillModel.StartDateTime_Local.AddHours(1);
     spillModel.AverageFlow_m3_day     = randomService.RandomDouble(0, 100000);
     Assert.IsTrue(spillModel.SpillComment.Length == 50);
     Assert.IsTrue(spillModel.MunicipalityTVItemID != 0);
     Assert.IsTrue(spillModel.InfrastructureTVItemID != 0);
     Assert.IsTrue(spillModel.StartDateTime_Local != null);
     Assert.IsTrue(spillModel.EndDateTime_Local != null);
     Assert.IsTrue(spillModel.AverageFlow_m3_day >= 0 && spillModel.AverageFlow_m3_day <= 100000);
 }
Exemplo n.º 22
0
        public void SpillService_GetSpillModelCountDB_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = AddSpillModel();

                    int spillCount = spillService.GetSpillModelCountDB();
                    Assert.AreEqual(testDBService.Count + 1, spillCount);
                }
            }
        }
Exemplo n.º 23
0
        public void SpillService_PostAddUpdateDeleteSpill_Good_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = AddSpillModel();

                    SpillModel spillModelRet2 = UpdateSpillModel(spillModelRet);

                    SpillModel spillModelRet3 = spillService.PostDeleteSpillDB(spillModelRet2.SpillID);
                    Assert.AreEqual("", spillModelRet3.Error);
                }
            }
        }
Exemplo n.º 24
0
        private SpillLanguageModel AddSpillLanguageModel(LanguageEnum LangToAdd, SpillModel spillModel)
        {
            SpillLanguageModel spillLanguageModelNew = new SpillLanguageModel();

            FillSpillLanguageModelNew(LangToAdd, spillModel, spillLanguageModelNew);

            SpillLanguageModel spillLanguagModelRet = spillLanguageService.PostAddSpillLanguageDB(spillLanguageModelNew);

            if (!string.IsNullOrWhiteSpace(spillLanguagModelRet.Error))
            {
                return(spillLanguagModelRet);
            }

            Assert.IsNotNull(spillLanguagModelRet);
            CompareSpillLanguageModels(spillLanguageModelNew, spillLanguagModelRet);

            return(spillLanguagModelRet);
        }
Exemplo n.º 25
0
        public void SpillService_GetSpillWithSpillIDDB_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = AddSpillModel();

                    Spill spillRet = spillService.GetSpillWithSpillIDDB(spillModelRet.SpillID);
                    Assert.AreEqual(spillModelRet.SpillID, spillRet.SpillID);

                    Spill spillRet2 = spillService.GetSpillWithSpillIDDB(0);
                    Assert.IsNull(spillRet2);
                }
            }
        }
Exemplo n.º 26
0
        public void SpillService_GetSpillModelListWithMunicipalityTVItemIDDB_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = AddSpillModel();

                    List <SpillModel> spillModelList = spillService.GetSpillModelListWithMunicipalityTVItemIDDB(spillModelRet.MunicipalityTVItemID);
                    Assert.IsTrue(spillModelList.Where(c => c.SpillID == spillModelRet.SpillID).Any());

                    int MunicipalityTVItemID = 0;
                    spillModelList = spillService.GetSpillModelListWithMunicipalityTVItemIDDB(MunicipalityTVItemID);
                    Assert.AreEqual(0, spillModelList.Count);
                }
            }
        }
Exemplo n.º 27
0
        public void SpillService_GetSpillModelWithSpillIDDB_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = AddSpillModel();

                    SpillModel spillModelRet2 = spillService.GetSpillModelWithSpillIDDB(spillModelRet.SpillID);
                    Assert.AreEqual(spillModelRet.SpillID, spillModelRet2.SpillID);

                    int        SpillID   = 0;
                    SpillModel spillRet2 = spillService.GetSpillModelWithSpillIDDB(SpillID);
                    Assert.AreEqual(string.Format(ServiceRes.CouldNotFind_With_Equal_, ServiceRes.Spill, ServiceRes.SpillID, SpillID), spillRet2.Error);
                }
            }
        }
Exemplo n.º 28
0
        private void CompareSpillModels(SpillModel spillModelNew, SpillModel spillModelRet)
        {
            Assert.AreEqual(spillModelNew.MunicipalityTVItemID, spillModelRet.MunicipalityTVItemID);
            Assert.AreEqual(spillModelNew.InfrastructureTVItemID, spillModelRet.InfrastructureTVItemID);
            Assert.AreEqual(spillModelNew.StartDateTime_Local, spillModelRet.StartDateTime_Local);
            Assert.AreEqual(spillModelNew.EndDateTime_Local, spillModelRet.EndDateTime_Local);
            Assert.AreEqual(spillModelNew.AverageFlow_m3_day, spillModelRet.AverageFlow_m3_day);

            foreach (LanguageEnum Lang in spillService.LanguageListAllowable)
            {
                SpillLanguageModel spillLanguageModel = spillService._SpillLanguageService.GetSpillLanguageModelWithSpillIDAndLanguageDB(spillModelRet.SpillID, Lang);

                Assert.AreEqual("", spillLanguageModel.Error);
                if (Lang == spillService.LanguageRequest)
                {
                    Assert.AreEqual(spillModelRet.SpillComment, spillLanguageModel.SpillComment);
                }
            }
        }
Exemplo n.º 29
0
        // Fill
        public string FillSpill(Spill spill, SpillModel spillModel, ContactOK contactOK)
        {
            spill.DBCommand              = (int)spillModel.DBCommand;
            spill.MunicipalityTVItemID   = spillModel.MunicipalityTVItemID;
            spill.InfrastructureTVItemID = spillModel.InfrastructureTVItemID;
            spill.StartDateTime_Local    = spillModel.StartDateTime_Local;
            spill.EndDateTime_Local      = spillModel.EndDateTime_Local;
            spill.AverageFlow_m3_day     = spillModel.AverageFlow_m3_day;
            spill.LastUpdateDate_UTC     = DateTime.UtcNow;
            if (contactOK == null)
            {
                spill.LastUpdateContactTVItemID = 2;
            }
            else
            {
                spill.LastUpdateContactTVItemID = contactOK.ContactTVItemID;
            }

            return("");
        }
Exemplo n.º 30
0
        public void SpillLanguageService_PostAddSpillLanguageDB_Good_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                SetupTest(contactModelListGood[0], culture);

                using (TransactionScope ts = new TransactionScope())
                {
                    SpillModel spillModelRet = spillServiceTest.AddSpillModel();

                    LanguageEnum LangToAdd = LanguageEnum.es;

                    SpillLanguageModel spillLanguageModelRet = AddSpillLanguageModel(LangToAdd, spillModelRet);

                    SpillLanguageModel spillLanguageModelRet2 = UpdateSpillLanguageModel(spillLanguageModelRet);

                    SpillLanguageModel spillLanguageModelRet3 = spillLanguageService.PostDeleteSpillLanguageDB(spillLanguageModelRet2.SpillID, LangToAdd);
                    Assert.AreEqual("", spillLanguageModelRet3.Error);
                }
            }
        }