public void BitwiseOrLittleEndian_NullInput_ThrowsArgumentNullException_Test(byte[] left, byte[] right) { // Arrange // Act // Assert Assert.Throws <ArgumentNullException>(() => ByteArrayUtils.BitwiseOrLittleEndian(left, right)); }
public void BitwiseOrLittleEndian_Test(byte[] expected, byte[] left, byte[] right) { // Arrange var leftOriginal = left.ToArray(); var rightOriginal = right.ToArray(); // Act var result = ByteArrayUtils.BitwiseOrLittleEndian(left, right); // Assert Assert.Equal(expected, result); Assert.Equal(leftOriginal, left); // input value not affected Assert.Equal(rightOriginal, right); // input value not affected }
public static void BitwiseOrLittleEndianExample() { // Setup var lhs = new byte[] { 0xC0, 0xDE }; var rhs = new byte[] { 0xC0, 0xFF, 0xEE }; // Act var result = ByteArrayUtils.BitwiseOrLittleEndian(lhs, rhs); // Conclusion Console.WriteLine("BitwiseOrLittleEndian Example"); Console.WriteLine($"lhs:\t{lhs.ToString("H")}"); Console.WriteLine($"rhs:\t{rhs.ToString("H")}"); Console.WriteLine($"result:\t{result.ToString("H")}"); Console.WriteLine(string.Empty); Console.WriteLine($"lhs:\t{lhs.ToString("b")}"); Console.WriteLine($"rhs:\t{rhs.ToString("b")}"); Console.WriteLine($"result:\t{result.ToString("b")}"); Console.WriteLine(string.Empty); }