public void WritesAbbreviationToLDML()
 {
     _writingSystem.ISO          = "blah";
     _writingSystem.Abbreviation = "bl";
     _writingSystemRepository.StoreDefinition(_writingSystem);
     AssertXmlFile.AtLeastOneMatch(PathToWS, "ldml/special/palaso:abbreviation[@value='bl']", LdmlAdaptor.MakeNameSpaceManager());
 }
 public void CanSetVariantToLDMLUsingSameWS()
 {
     _writingSystemRepository.StoreDefinition(_writingSystem);
     _writingSystem.Variant = "piglatin";
     _writingSystemRepository.StoreDefinition(_writingSystem);
     AssertXmlFile.AtLeastOneMatch(PathToWS, "ldml/identity/variant[@type='piglatin']");
 }
        public void CanRemoveAbbreviation()
        {
            _writingSystem.ISO          = "en";
            _writingSystem.Abbreviation = "abbrev";
            _writingSystemRepository.StoreDefinition(_writingSystem);
            string path = _writingSystemRepository.PathToWritingSystem(_writingSystem);

            AssertXmlFile.AtLeastOneMatch(path, "ldml/special/palaso:abbreviation", LdmlAdaptor.MakeNameSpaceManager());
            _writingSystem.Abbreviation = string.Empty;
            _writingSystemRepository.StoreDefinition(_writingSystem);
            TestUtilities.AssertXPathIsNull(PathToWS, "ldml/special/palaso:abbreviation", LdmlAdaptor.MakeNameSpaceManager());
        }
        public void CanRemoveVariant()
        {
            _writingSystem.ISO     = "en";
            _writingSystem.Variant = "piglatin";
            _writingSystemRepository.StoreDefinition(_writingSystem);
            string path = _writingSystemRepository.PathToWritingSystem(_writingSystem);

            AssertXmlFile.AtLeastOneMatch(path, "ldml/identity/variant");
            _writingSystem.Variant = string.Empty;
            _writingSystemRepository.StoreDefinition(_writingSystem);
            TestUtilities.AssertXPathIsNull(PathToWS, "ldml/identity/variant");
        }
        public void CanSetVariantToExistingLDML()
        {
            _writingSystem.ISO          = "blah";
            _writingSystem.Abbreviation = "bl";            //crucially, abbreviation isn't part of the name of the file
            _writingSystemRepository.StoreDefinition(_writingSystem);

            //here, the task is not to overwrite what was in ther already
            WritingSystemDefinition ws2 = new WritingSystemDefinition();

            ws2         = _writingSystemRepository.LoadDefinition("blah");
            ws2.Variant = "piglatin";
            _writingSystemRepository.StoreDefinition(ws2);
            string path = Path.Combine(_writingSystemRepository.PathToWritingSystems, _writingSystemRepository.GetFileName(ws2));

            AssertXmlFile.AtLeastOneMatch(path, "ldml/identity/variant[@type='piglatin']");
            AssertXmlFile.AtLeastOneMatch(path, "ldml/special/palaso:abbreviation[@value='bl']", LdmlAdaptor.MakeNameSpaceManager());
        }
 public void MakesNewFileIfNeeded()
 {
     _writingSystem.ISO = "blah";
     _writingSystemRepository.StoreDefinition(_writingSystem);
     AssertXmlFile.AtLeastOneMatch(PathToWS, "ldml/identity/language[@type='blah']");
 }