public void Read_InitializedObject_ReturnsExpectedValue(params int[] initValues) { var bits = MockBitFactory.CreateMockBits(initValues); var bitAggregate = new BitAggregate(bits); var bitValues = bitAggregate.Read(); Assert.Equal(bitValues, initValues); }
public void Clear_ZeroesAllBits() { var bitAggregate = new BitAggregate(MockBitFactory.CreateMockBits(0, 1, 0, 0, 1, 1, 0, 0)); bitAggregate.Clear(); var bitValues = bitAggregate.Read(); Assert.Equal(bitValues, ListFactory.CreateList(0, 0, 0, 0, 0, 0, 0, 0)); }
public void ShiftRight_PerformsAsExpected(int lowestBitValue) { var bitAggregate = new BitAggregate(MockBitFactory.CreateMockBits(lowestBitValue, 0, 1, 0, 1, 0, 1, 0)); int carryFlagValue = bitAggregate.ShiftRight(); var bitValues = bitAggregate.Read(); Assert.Equal(bitValues, ListFactory.CreateList(0, 1, 0, 1, 0, 1, 0, 0)); Assert.Equal(lowestBitValue, carryFlagValue); }
public void Constructor_EmptyInput_ThrowsException() { Action action = () => { new BitAggregate(MockBitFactory.CreateMockBits()); }; Assert.Throws <ArgumentOutOfRangeException>(action); }
public void Constructor_ValidInput_ReturnsBitAggregate() { var bitAggregate = new BitAggregate(MockBitFactory.CreateMockBits(0, 0, 0, 0, 0, 0, 0, 0)); Assert.NotNull(bitAggregate); }