public void Xor() { MutableBitField bf2 = new MutableBitField(secondValues); bf.Xor(bf2); Assert.AreEqual(new BitField(secondValues), bf2, "#1: bf2 should be unmodified"); for (int i = 0; i < bf.Length; i++) { Assert.AreEqual((initalValues[i] || secondValues[i]) && !(initalValues[i] && secondValues[i]), bf[i], "#2"); } int count = 0; for (int i = 0; i < initalValues.Length; i++) { if ((initalValues[i] || secondValues[i]) && !(initalValues[i] && secondValues[i])) { count++; } } Assert.AreEqual(count, bf.TrueCount, "#3"); }