public void TuplesTest()
        {
            var json = "{}";

            repositoryCountries = new RepositoryCountries(json);
            var actual = repositoryCountries.GetNames();
            List <Tuple <string, string> > expactedTuples = new List <Tuple <string, string> >();

            Assert.AreEqual(expactedTuples, actual);
        }
        public void TuplesOneTest()
        {
            var json = "{\"AD\": \"Андорра\"}";

            repositoryCountries = new RepositoryCountries(json);
            var actual = repositoryCountries.GetNames();
            List <Tuple <string, string> > expactedTuples = new List <Tuple <string, string> >();

            expactedTuples.Add(Tuple.Create("AD", "Андорра"));
            Assert.AreEqual(expactedTuples, actual);
        }
        public void TuplesTwoTest()
        {
            var json = "{\"AD\": \"Андорра\",\"AE\": \"Объединенные Арабские Эмираты\"}";

            repositoryCountries = new RepositoryCountries(json);
            var actual = repositoryCountries.GetNames();
            List <Tuple <string, string> > expactedTuples = new List <Tuple <string, string> >();

            expactedTuples.Add(Tuple.Create("AD", "Андорра"));
            expactedTuples.Add(Tuple.Create("AE", "Объединенные Арабские Эмираты"));
            Assert.AreEqual(expactedTuples, actual);
        }
        public void CtorTestEmpty()
        {
            var json = "{}";

            repositoryCountries = new RepositoryCountries(json);

            Dictionary <string, string> expectedDictionary = new Dictionary <string, string>();

            var actual = repositoryCountries.GetType().GetRuntimeFields().First(f => f.Name.Equals("_countriesDict"))
                         .GetValue(repositoryCountries) as Dictionary <string, string>;

            CollectionAssert.AreEqual(expectedDictionary, actual);
        }
        public void CtorTestOneElement()
        {
            var json = "{\"AD\": \"Андорра\"}";

            repositoryCountries = new RepositoryCountries(json);

            Dictionary <string, string> expectedDictionary = new Dictionary <string, string>();

            expectedDictionary.Add("AD", "Андорра");

            var actual = repositoryCountries.GetType().GetRuntimeFields().First(f => f.Name.Equals("_countriesDict"))
                         .GetValue(repositoryCountries) as Dictionary <string, string>;

            CollectionAssert.AreEqual(expectedDictionary, actual);
        }
示例#6
0
        //checking of generic repository from .DAL.Repository.cs
        public void RepoCheck()
        {
            ORCL_HR orcl_db = new ORCL_HR();

            SB.Entities.COUNTRIES ctr = new SB.Entities.COUNTRIES();

            Repository <SB.Entities.COUNTRIES> repo = new Repository <SB.Entities.COUNTRIES>(orcl_db);

            IQueryable <SB.Entities.COUNTRIES> items = repo.GetAll();
            int item_count = items.Count();

            RepositoryCountries repoCountries = new RepositoryCountries(orcl_db);

            items      = repoCountries.countriesByRegion(1);
            item_count = items.Count();
            repoCountries.display(items);
        }
        public void CtorTestManyElements()
        {
            var json = "{\"AD\": \"Андорра\",\"AE\": \"Объединенные Арабские Эмираты\",\"AB\": \"Объединенные Арабские Эмираты\",\"AF\": \"Объединенные Арабские Эмираты\",\"AR\": \"Объединенные Арабские Эмираты\"}";

            repositoryCountries = new RepositoryCountries(json);

            Dictionary <string, string> expectedDictionary = new Dictionary <string, string>();

            expectedDictionary.Add("AD", "Андорра");
            expectedDictionary.Add("AE", "Объединенные Арабские Эмираты");
            expectedDictionary.Add("AB", "Объединенные Арабские Эмираты");
            expectedDictionary.Add("AF", "Объединенные Арабские Эмираты");
            expectedDictionary.Add("AR", "Объединенные Арабские Эмираты");

            var actual = repositoryCountries.GetType().GetRuntimeFields().First(f => f.Name.Equals("_countriesDict"))
                         .GetValue(repositoryCountries) as Dictionary <string, string>;

            CollectionAssert.AreEqual(expectedDictionary, actual);
        }