Ejemplo n.º 1
0
 public void Add_multiple_profiles()
 {
     Translator.AddProfiles(new List <TranslationProfile> {
         new BasicProfile(), new BasicProfile2(), new SpyProfile()
     });
     Assert.AreEqual(3, Translator.GetAllProfiles().Count());
 }
Ejemplo n.º 2
0
        public void Get_profile_using_name_with_no_matches_returns_null()
        {
            Translator.AddProfiles(new List <TranslationProfile> {
                new BasicProfile(), new BasicProfile2(), new SpyProfile()
            });
            var foundProfile = Translator.GetProfile("ABC");

            Assert.IsNull(foundProfile);
        }
Ejemplo n.º 3
0
        public void Get_profiles_using_predicate_with_no_matches_returns_empty_collection()
        {
            Translator.AddProfiles(new List <TranslationProfile> {
                new BasicProfile(), new BasicProfile2(), new SpyProfile()
            });
            Func <TranslationProfile, bool> pred = t => t.ProfileName.Contains("XYZ");

            Assert.AreEqual(0, Translator.GetProfiles(pred).Count());
        }
Ejemplo n.º 4
0
        public void Get_profiles_using_predicate()
        {
            Translator.AddProfiles(new List <TranslationProfile> {
                new BasicProfile(), new BasicProfile2(), new SpyProfile()
            });
            Func <TranslationProfile, bool> pred = t => t.ProfileName.Contains("Basic");

            Assert.AreEqual(2, Translator.GetProfiles(pred).Count());
        }
Ejemplo n.º 5
0
        public void Get_profile_using_null_or_empty_name_returns_null(string profileName)
        {
            Translator.AddProfiles(new List <TranslationProfile> {
                new BasicProfile(), new BasicProfile2(), new SpyProfile()
            });
            var foundProfile = Translator.GetProfile(profileName);

            Assert.IsNull(foundProfile);
        }
Ejemplo n.º 6
0
        public void Get_profile_using_name()
        {
            Translator.AddProfiles(new List <TranslationProfile> {
                new BasicProfile(), new BasicProfile2(), new SpyProfile()
            });
            var foundProfile = Translator.GetProfile("BasicProfile");

            Assert.IsNotNull(foundProfile);
            Assert.IsInstanceOf <BasicProfile>(foundProfile);
        }
Ejemplo n.º 7
0
        public void Remove_profiles_using_predicate()
        {
            Translator.AddProfiles(new List <TranslationProfile> {
                new BasicProfile(), new BasicProfile2(), new SpyProfile()
            });
            Func <TranslationProfile, bool> pred = t => t.ProfileName.Contains("Basic");

            Translator.RemoveProfiles(pred);
            Translator.ApplyUpdates();
            Assert.AreEqual(1, Translator.GetAllProfiles().Count());
        }
Ejemplo n.º 8
0
 public void Add_multiple_profiles_with_an_enumerable_that_contains_a_null_throws_ArgumentException()
 {
     Assert.Throws <ArgumentException>(() => Translator.AddProfiles(new List <TranslationProfile> {
         new BasicProfile(), null, new BasicProfile2()
     }));
 }
Ejemplo n.º 9
0
 public void Add_multiple_profiles_with_null_parameter_throws_ArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => Translator.AddProfiles(null));
 }