public void WritingSystemIdHasChangedTo_IdExistsAndHasNeverChanged_ReturnsId() { //Add a writing system to the repo var ws = new WritingSystemDefinition("en"); RepositoryUnderTest.Set(ws); RepositoryUnderTest.Save(); Assert.That(RepositoryUnderTest.WritingSystemIdHasChangedTo("en"), Is.EqualTo("en")); }
public void WritingSystemIdHasChangedTo_IdChanged_ReturnsNewId() { //Add a writing system to the repo var ws = new WritingSystemDefinition("en"); RepositoryUnderTest.Set(ws); RepositoryUnderTest.Save(); //Now change the Id ws.Variants.Add("bogus"); RepositoryUnderTest.Save(); Assert.That(RepositoryUnderTest.WritingSystemIdHasChangedTo("en"), Is.EqualTo("en-x-bogus")); }
public void WritingSystemIdHasBeenChanged_IdChanged_ReturnsTrue() { //Add a writing system to the repo var ws = new WritingSystemDefinition("en"); RepositoryUnderTest.Set(ws); RepositoryUnderTest.Save(); //Now change the Id ws.Variant = "x-bogus"; RepositoryUnderTest.Save(); Assert.That(RepositoryUnderTest.WritingSystemIdHasChanged("en"), Is.True); }
public void WritingSystemIdHasChangedTo_IdChangedToMultipleDifferentNewIds_ReturnsNull() { //Add a writing system to the repo var wsEn = new WritingSystemDefinition("en"); RepositoryUnderTest.Set(wsEn); RepositoryUnderTest.Save(); //Now change the Id and create a duplicate of the original Id wsEn.Variants.Add("bogus"); RepositoryUnderTest.Set(wsEn); var wsEnDup = new WritingSystemDefinition("en"); RepositoryUnderTest.Set(wsEnDup); RepositoryUnderTest.Save(); //Now change the duplicate's Id as well wsEnDup.Variants.Add("bogus2"); RepositoryUnderTest.Set(wsEnDup); RepositoryUnderTest.Save(); Assert.That(RepositoryUnderTest.WritingSystemIdHasChangedTo("en"), Is.Null); }