Ejemplo n.º 1
0
        public void AddLanguage_ThrowsExceptionIfRowExists()
        {
            using (TransactionScope transaction = new TransactionScope())
            {
                //Arrange
                CountrySqlDALTests.InsertFakeCountry("JRT", "Fake Country", "North America");
                LanguageSqlDALTests.InsertFakeLanguage("JRT", "TEST LANGUAGE", true);
                LanguageSqlDAL testClass   = new LanguageSqlDAL(connectionString);
                Language       newLanguage = new Language();
                newLanguage.CountryCode = "JRT";
                newLanguage.Name        = "TEST LANGUAGE";
                newLanguage.IsOfficial  = true;
                newLanguage.Percentage  = 100;

                //Act
                bool output = testClass.AddNewLanguage(newLanguage);
            }
        }
Ejemplo n.º 2
0
        public void LanguagesByCountry_OfficialLanguages()
        {
            using (TransactionScope transaction = new TransactionScope())
            {
                // Arrange
                CountrySqlDALTests.InsertFakeCountry("JRT", "Joshtopia", "North America");
                LanguageSqlDALTests.InsertFakeLanguage("JRT", "Official Language", true);
                LanguageSqlDALTests.InsertFakeLanguage("JRT", "Unofficial Languauge", false);
                LanguageSqlDAL testClass = new LanguageSqlDAL(connectionString);

                // Act
                List <Language> languages = testClass.GetLanguages("JRT", true);

                // Assert
                Assert.AreEqual(1, languages.Count);
                Assert.AreEqual("Official Language", languages[0].Name);
            }
        }