//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testMasks() public virtual void TestMasks() { assertEquals(0, 1 & LongerShortString.invertedBitMask(LongerShortString.Numerical)); assertEquals(0, 2 & LongerShortString.invertedBitMask(LongerShortString.Date)); assertEquals(LongerShortString.Numerical.bitMask(), 3 & LongerShortString.invertedBitMask(LongerShortString.Date)); assertEquals(0, LongerShortString.Numerical.bitMask() & LongerShortString.invertedBitMask(LongerShortString.Numerical, LongerShortString.Date)); }
private void AssertCanEncodeAndDecodeToSame(string @string, int payloadSize) { PropertyBlock target = new PropertyBlock(); assertTrue(LongerShortString.encode(0, @string, target, payloadSize)); assertEquals(Values.stringValue(@string), LongerShortString.decode(target)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testRandomStrings() public virtual void TestRandomStrings() { for (int i = 0; i < 1000; i++) { foreach (TestStringCharset charset in TestStringCharset.values()) { IList <string> list = RandomStrings(100, charset, 30); foreach (string @string in list) { PropertyBlock record = new PropertyBlock(); if (LongerShortString.encode(10, @string, record, DEFAULT_PAYLOAD_SIZE)) { assertEquals(Values.stringValue(@string), LongerShortString.decode(record)); } } } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void writeString(String value) throws IllegalArgumentException public override void WriteString(string value) { // Try short string first, i.e. inlined in the property block if (LongerShortString.encode(KeyId, value, Block, PropertyType.PayloadSize)) { return; } // Fall back to dynamic string store sbyte[] encodedString = EncodeString(value); IList <DynamicRecord> valueRecords = new List <DynamicRecord>(); AllocateStringRecords(valueRecords, encodedString, StringAllocator); SetSingleBlockValue(Block, KeyId, PropertyType.String, Iterables.first(valueRecords).Id); foreach (DynamicRecord valueRecord in valueRecords) { valueRecord.SetType(PropertyType.String.intValue()); } Block.ValueRecords = valueRecords; }
private void AssertCannotEncode(string @string, int payloadSize) { assertFalse(LongerShortString.encode(0, @string, new PropertyBlock(), payloadSize)); }