예제 #1
0
 public void can_add_language()
 {
     var subject = new Provider() {Id = 1};
     var language = new Language(false, 1, "English", true);
     var providerLanguage = subject.AddLanguage(language);
     Assert.IsNotNull(providerLanguage);
     Assert.AreSame(language, providerLanguage.Language);
     Assert.AreSame(subject, providerLanguage.Provider);
 }
예제 #2
0
        public void throws_exception_when_setting_primary_language_to_fluent()
        {
            var subject = new Provider() { Id = 1 };
            var english = new Language(false, 1, "English", true);
            var spanish = new Language(false, 2, "Spanish", true);

            var englishAdded = subject.AddLanguage(english);
            var spanishAdded = subject.AddLanguage(spanish);

            Provider.SetFluentLanguage(englishAdded, true);
        }
예제 #3
0
        public void throws_exception_when_removing_last_primary_language()
        {
            var subject = new Provider() { Id = 1 };
            var english = new Language(false, 1, "English", true);
            var spanish = new Language(false, 2, "Spanish", true);

            subject.AddLanguage(english);
            subject.AddLanguage(spanish);

            subject.RemoveLanguage(english);
        }
예제 #4
0
 public void throws_exception_when_associating_language_previously_associated()
 {
     var subject = new Provider() {Id = 1};
     var language = new Language(false, 1, "English", true);
     subject.AddLanguage(language);
     var languageDupe = new Language(false, 1, "English", true);
     subject.AddLanguage(languageDupe);
 }
예제 #5
0
 public void throws_exception_when_adding_null_language()
 {
     var subject = new Provider();
     subject.AddLanguage(null);
 }
예제 #6
0
        public void can_set_primary_language_on_language_that_is_already_primary()
        {
            var subject = new Provider() { Id = 1 };
            var english = new Language(false, 1, "English", true);

            var englishAdded = subject.AddLanguage(english);

            Assert.IsTrue(englishAdded.IsPrimary);
            subject.SetPrimaryLanguage(englishAdded);
            Assert.IsTrue(englishAdded.IsPrimary);
        }
예제 #7
0
        public void can_set_primary_language()
        {
            var subject = new Provider() { Id = 1 };
            var english = new Language(false, 1, "English", true);
            var spanish = new Language(false, 2, "Spanish", true);

            var englishAdded = subject.AddLanguage(english);
            var spanishAdded = subject.AddLanguage(spanish);

            subject.SetPrimaryLanguage(spanishAdded);

            Assert.IsFalse(englishAdded.IsPrimary);
            Assert.IsTrue(spanishAdded.IsPrimary);
        }
예제 #8
0
        public void can_set_fluent_language()
        {
            var subject = new Provider() { Id = 1 };
            var english = new Language(false, 1, "English", true);
            var spanish = new Language(false, 2, "Spanish", true);

            var englishAdded = subject.AddLanguage(english);
            var spanishAdded = subject.AddLanguage(spanish);

            Provider.SetFluentLanguage(spanishAdded, true);

            Assert.IsFalse(englishAdded.IsFluent);
            Assert.IsTrue(spanishAdded.IsFluent);
        }
예제 #9
0
        public void can_remove_nonprimary_language()
        {
            var subject = new Provider() { Id = 1};
            var firstLanguage = new Language(false, 1, "English", true);
            var secondLanguage = new Language(false, 2, "Spanish", true);

            subject.AddLanguage(firstLanguage);
            subject.AddLanguage(secondLanguage);

            var removed = subject.RemoveLanguage(secondLanguage);

            Assert.AreEqual(secondLanguage, removed.Language);
            Assert.IsTrue(subject.ProviderLanguages.Count == 1);
        }