public void TestEqual() { var left = new Counter32(100); var right = new Counter32(100); Assert.AreEqual(left, right); Assert.IsFalse(left.Equals(1)); }
public void TestEqual() { var left = new Counter32(100); var right = new Counter32(100); Assert.AreEqual(left, right); Assert.IsFalse(left.Equals(1)); }
public void TestConstructor() { byte[] buffer2 = new byte[] { 01, 44 }; Counter32 c2 = new Counter32(buffer2); Assert.AreEqual(300, c2.ToUInt32()); Assert.AreEqual("300", c2.ToString()); Counter32 sec = new Counter32(300); Counter32 thr = new Counter32(301); Assert.IsTrue(c2.Equals(sec)); Assert.AreEqual(300.GetHashCode(), c2.GetHashCode()); Assert.IsTrue(c2 == sec); Assert.IsTrue(c2 != thr); Assert.IsFalse(c2 == null); Assert.IsFalse(null == sec); Assert.IsTrue(c2 == c2); byte[] buffer1 = new byte[] { 13 }; Counter32 c1 = new Counter32(buffer1); Assert.AreEqual(13, c1.ToUInt32()); byte[] buffer3 = new byte[] { 1, 17, 112 }; Counter32 c3 = new Counter32(buffer3); Assert.AreEqual(70000, c3.ToUInt32()); byte[] buffer4 = new byte[] { 1, 201, 195, 128 }; Counter32 c4 = new Counter32(buffer4); Assert.AreEqual(30000000, c4.ToUInt32()); byte[] buffer5 = new byte[] { 0, 255, 255, 255, 255 }; Counter32 c5 = new Counter32(buffer5); Assert.AreEqual(uint.MaxValue, c5.ToUInt32()); byte[] buffer0 = new byte[] { 0 }; Counter32 c0 = new Counter32(buffer0); Assert.AreEqual(uint.MinValue, c0.ToUInt32()); }
public void TestConstructor() { byte[] buffer2 = new byte[] {01, 44}; Counter32 c2 = new Counter32(buffer2); Assert.AreEqual(300, c2.ToUInt32()); Assert.AreEqual("300", c2.ToString()); Counter32 sec = new Counter32(300); Counter32 thr = new Counter32(301); Assert.IsTrue(c2.Equals(sec)); Assert.AreEqual(300.GetHashCode(), c2.GetHashCode()); Assert.IsTrue(c2 == sec); Assert.IsTrue(c2 != thr); Assert.IsFalse(c2 == null); Assert.IsFalse(null == sec); Assert.IsTrue(c2 == c2); byte[] buffer1 = new byte[] {13}; Counter32 c1 = new Counter32(buffer1); Assert.AreEqual(13, c1.ToUInt32()); byte[] buffer3 = new byte[] {1, 17, 112}; Counter32 c3 = new Counter32(buffer3); Assert.AreEqual(70000, c3.ToUInt32()); byte[] buffer4 = new byte[] {1, 201, 195, 128}; Counter32 c4 = new Counter32(buffer4); Assert.AreEqual(30000000, c4.ToUInt32()); byte[] buffer5 = new byte[] {0, 255, 255, 255, 255}; Counter32 c5 = new Counter32(buffer5); Assert.AreEqual(uint.MaxValue, c5.ToUInt32()); byte[] buffer0 = new byte[] {0}; Counter32 c0 = new Counter32(buffer0); Assert.AreEqual(uint.MinValue, c0.ToUInt32()); }