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); }
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); }
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); }
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); }
public void throws_exception_when_adding_null_language() { var subject = new Provider(); subject.AddLanguage(null); }
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); }
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); }
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); }
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); }