public void TestUIntFixedRoundTripSerialization(UInt32 value, int numBits) { for (var i = 0; i < 2; ++i) { var bw = new BitWriter(32); bw.WriteFixedBitCount(value, numBits); var br = new BitReader(bw.GetBits(0, bw.Length).ToArray()); var val2 = br.ReadUInt32FromBits(numBits); Assert.AreEqual(value, val2); Assert.AreEqual(bw.Length, br.Position); value = val2; } }