public void Add_multiple_profiles()
 {
     Translator.AddProfiles(new List <TranslationProfile> {
         new BasicProfile(), new BasicProfile2(), new SpyProfile()
     });
     Assert.AreEqual(3, Translator.GetAllProfiles().Count());
 }
        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);
        }
        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());
        }
        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());
        }
        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);
        }
        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);
        }
        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());
        }
Пример #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()
     }));
 }
Пример #9
0
 public void Add_multiple_profiles_with_null_parameter_throws_ArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => Translator.AddProfiles(null));
 }