public void WillNotFindValuesOutOfRange() { var a = new[] { 1, 5, 9, 12, 15, 17, 22, 33, 37, 40, 42, 50, 55, 70, 75, 100 }; var table = new ValueRangeTable(a); Assert.False(table.Contains(0)); Assert.False(table.Contains(8)); Assert.False(table.Contains(13)); Assert.False(table.Contains(19)); Assert.False(table.Contains(35)); Assert.False(table.Contains(41)); Assert.False(table.Contains(52)); Assert.False(table.Contains(73)); Assert.False(table.Contains(101)); }
public void WillFindValuesInRange() { var a = new[] { 1, 5, 9, 12, 15, 17, 22, 33, 37, 40, 42, 50, 55, 70, 75, 100 }; var table = new ValueRangeTable(a); table.Contains(1).ShouldBeTrue(); table.Contains(4).ShouldBeTrue(); Assert.True(table.Contains(11)); Assert.True(table.Contains(12)); Assert.True(table.Contains(31)); Assert.True(table.Contains(38)); Assert.True(table.Contains(45)); Assert.True(table.Contains(56)); Assert.True(table.Contains(88)); }
/// <summary> /// Create Nodeprep profile /// </summary> /// <returns>Nodeprep process</returns> public static IPreparationProcess Create() { return(PreparationProcess.Build() .WithMappingStep(MappingTable.Build() .WithMappingTable(Mapping.B_1) .WithMappingTable(Mapping.B_2) .Compile()) .WithNormalizationStep() .WithProhibitedValueStep(ValueRangeTable.Create( Prohibited.C_1_1, Prohibited.C_1_2, Prohibited.C_2_1, Prohibited.C_2_2, Prohibited.C_3, Prohibited.C_4, Prohibited.C_5, Prohibited.C_6, Prohibited.C_7, Prohibited.C_8, Prohibited.C_9, NodeprepProhibited)) .WithBidirectionalStep() .WithProhibitedValueStep(ValueRangeTable.Create( Unassigned.A_1)) .Compile()); }
public BidirectionalStepTest() { _step = new BidirectionalStep( ValueRangeTable.Create(Prohibited.C8), ValueRangeTable.Create(BidirectionalTables.D1), ValueRangeTable.Create(BidirectionalTables.D2)); }
public void WillNotProhibitValuesNotInTable() { var input = "ThisIsAStringWithoutSpaces"; var step = new ProhibitedValueStep(ValueRangeTable.Build(Tables.C_1_1).Compile()); var output = step.Run(input); Assert.Equal(input, output); }
public void WillNotProhibitValuesNotInTable() { const string input = "ThisIsAStringWithoutSpaces"; var step = new ProhibitedValueStep(ValueRangeTable.Build(Prohibited.C11).Compile()); var output = step.Run(input); output.ShouldBe(input); }
public void WillProhibitValuesInTable() { var input = $"{Convert.ToChar(0x20)}"; var step = new ProhibitedValueStep(ValueRangeTable.Build(Prohibited.C11).Compile()); Action run = () => { step.Run(input); }; run.ShouldThrow <ProhibitedValueException>(); }
public void WillProhibitValuesInTable() { var input = new StringBuilder(); input.Append(Convert.ToChar(0x20)); var step = new ProhibitedValueStep(ValueRangeTable.Build(Tables.C_1_1).Compile()); Assert.Throws <ProhibitedValueException>(() => step.Run(input.ToString())); }
public void WillThrowForMixedRALAndLCharacters() { var input = "" + Convert.ToChar(0x05BE) + Convert.ToChar(0x0041); var step = new BidirectionalStep( ValueRangeTable.Create(Prohibited.C_8), ValueRangeTable.Create(Bidirectional.D_1), ValueRangeTable.Create(Bidirectional.D_2)); Assert.Throws <BidirectionalFormatException>(() => step.Run(input)); }
public void WillThrowForRALStringNotEndingWithRALCharacter() { var input = "" + Convert.ToChar(0x0627) + "1"; var step = new BidirectionalStep( ValueRangeTable.Create(Prohibited.C_8), ValueRangeTable.Create(Bidirectional.D_1), ValueRangeTable.Create(Bidirectional.D_2)); Assert.Throws <BidirectionalFormatException>(() => step.Run(input)); }
public void WillThrowForProhibitValues() { var input = Convert.ToChar(0x0340).ToString(); var step = new BidirectionalStep( ValueRangeTable.Create(Prohibited.C_8), ValueRangeTable.Create(Bidirectional.D_1), ValueRangeTable.Create(Bidirectional.D_2)); Assert.Throws <ProhibitedValueException>(() => step.Run(input)); }
public void WillPassForRALStringEndingWithRALCharacter() { var input = "" + Convert.ToChar(0x0627) + "1" + Convert.ToChar(0x0628); var step = new BidirectionalStep( ValueRangeTable.Create(Prohibited.C_8), ValueRangeTable.Create(Bidirectional.D_1), ValueRangeTable.Create(Bidirectional.D_2)); var output = step.Run(input); Assert.Equal(input, output); }
public static IPreparationProcess Create() { return(StringPrep.PreparationProcess.Build() .WithMappingStep(MappingTable.Build() .WithValueRangeTable(Prohibited.ASCIISpaceCharacters, ' ') .WithMappingTable(Mapping.MappedToNothing) .Compile()) .WithNormalizationStep() .WithProhibitedValueStep(ValueRangeTable.Create( Prohibited.NonASCIISpaceCharacters, Prohibited.ASCIIControlCharacters, Prohibited.NonASCIIControlCharacters, Prohibited.PrivateUseCharacters, Prohibited.NonCharacterCodePoints, Prohibited.SurrogateCodePoints, Prohibited.InappropriateForPlainText, Prohibited.InappropriateForCanonicalRepresentation, Prohibited.TaggingCharacters)) .WithBidirectionalStep() .WithProhibitedValueStep(ValueRangeTable.Create( Unassigned.UnassignedCodePoints)) .Compile()); }