public void AddDuplicate1AbbreviationsToEmptyGlossary_ExpectExceptions() { Glossary glossary = new Glossary(); glossary.AddGlossaryItem(new GlossaryItem("Happy Otters", "HO", true)); Assert.Throws <DuplicateNameException>(() => glossary.AddGlossaryItem(new GlossaryItem("Hearing Office", "HO", true))); }
public void FullTest2() { Glossary g = new Glossary(); g.AddGlossaryItem(new GlossaryItem("Person", "PRSN", true)); g.AddGlossaryItem(new GlossaryItem("First Name", "FNM", true)); string logicalName = "Person First Name"; string physicalName = "PRSN_FNM"; GlossaryComplianceResult result = g.CheckCompliance(logicalName, physicalName); Console.WriteLine(g.ExpandAbbreviation("PRSN_FNM").Output); Assert.Equal(result.Term, logicalName); Assert.Equal(result.Abbreviation, physicalName); Assert.Equal(logicalName, result.AbbreviationToTerm); Assert.Equal(physicalName, result.TermToAbbreviation); Assert.Equal(result.TermToAbbreviation, result.AbbreviationToTermToAbbreviation); Assert.Equal(result.AbbreviationToTerm, result.TermToAbbreviationToTerm); Assert.True(result.PreferredTermIsUsed); Assert.False(result.CompoundAvailable); Assert.False(result.Mismatch); Assert.False(result.HyphenNeededForTerm); Assert.True(result.TermAbbreviatesCorrectly); Assert.True(result.AbbreviationExpandsToTermCorrectly); Assert.True(result.EvaluationTimeSpan.TotalMilliseconds > 0); }
public void AddMultipleSynonymousAbbreviationsAndOne1ToEmptyGlossary_ExpectNoExceptions() { Glossary glossary = new Glossary(); glossary.AddGlossaryItem(new GlossaryItem("Happy Octopus", "HO", false)); glossary.AddGlossaryItem(new GlossaryItem("Happy Otters", "HO", false)); glossary.AddGlossaryItem(new GlossaryItem("Hearing Office", "HO", true)); }
public void RemoveGlossaryItem_ExpectNoExceptions() { Glossary glossary = new Glossary(); GlossaryItem gi = new GlossaryItem("Happy Octopus", "HO", false); glossary.AddGlossaryItem(gi); glossary.AddGlossaryItem(new GlossaryItem("Happy Otters", "HO", false)); glossary.AddGlossaryItem(new GlossaryItem("Hearing Office", "HO", true)); Assert.Equal(3, glossary.GlossaryItems.Count); glossary.RemoveGlossaryItem(gi); Assert.Equal(2, glossary.GlossaryItems.Count); }
public static Glossary GetTestGlossary() { Glossary g = new Glossary(); g.AddGlossaryItem(new GlossaryItem("Person", "PRSN", true)); g.AddGlossaryItem(new GlossaryItem("First", "FRST", true)); g.AddGlossaryItem(new GlossaryItem("Name", "NM", true)); g.AddGlossaryItem(new GlossaryItem("First Name", "FNM", true)); g.AddGlossaryItem(new GlossaryItem("Hearing", "HRG", true)); g.AddGlossaryItem(new GlossaryItem("Office", "OFC", true)); g.AddGlossaryItem(new GlossaryItem("Code", "CD", true)); g.AddGlossaryItem(new GlossaryItem("Hearing Office", "HOFC", true)); g.AddGlossaryItem(new GlossaryItem("Hearing Office Code", "HOCD", true)); g.AddGlossaryItem(new GlossaryItem("Office Code", "OCD", true)); return(g); }
public void ReadMeExample1() { Glossary g = new Glossary(); g.TermConverterConfiguration.DelimeterForNotFound_Left = "<"; g.TermConverterConfiguration.DelimeterForNotFound_Right = ">"; g.AddGlossaryItem(new GlossaryItem("Person", "PRSN", true)); g.AddGlossaryItem(new GlossaryItem("First Name", "FNM", true)); TermConversionResult exapndResult1 = g.ExpandAbbreviation("PRSN_FNM"); Console.WriteLine(exapndResult1.Output); //Person First Name TermConversionResult exapndResult2 = g.ExpandAbbreviation("PRSN_PRNT_FNM"); Console.WriteLine(exapndResult2.Output); //Person <PRNT> First Name }
public void ReadMeExample2() { Glossary g = new Glossary(); g.AddGlossaryItem(new GlossaryItem("Person", "PRSN", true)); g.AddGlossaryItem(new GlossaryItem("First Name", "FNM", true)); string term = "Person First name"; string abbreviation = "PRSN_FNM"; GlossaryComplianceResult result = g.CheckCompliance(term, abbreviation); Console.WriteLine(result.PreferredTermIsUsed); //true Console.WriteLine(result.TermAbbreviatesCorrectly); //true Console.WriteLine(result.AbbreviationExpandsToTermCorrectly); //true }