public void Update_WithNullData_ThrowsException() { var bitAggregate = new BitAggregate(MockBitFactory.CreateEmptyMockBits(8)); Action action = () => { bitAggregate.Update(null); }; Assert.Throws <ArgumentNullException>(action); }
public void Update_WithInvalidData_ThrowsException(params int[] updateValues) { var bitAggregate = new BitAggregate(MockBitFactory.CreateEmptyMockBits(8)); Action action = () => { bitAggregate.Update(updateValues); }; Assert.Throws <ArgumentOutOfRangeException>(action); }
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 Update_WithValidData_MakesExpectedChanges(params int[] updateValues) { var bitAggregate = new BitAggregate(MockBitFactory.CreateEmptyMockBits(8)); bitAggregate.Update(updateValues); var bitValues = bitAggregate.Read(); Assert.Equal(bitValues, updateValues); }
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_ValidInput_ReturnsBitAggregate() { var bitAggregate = new BitAggregate(MockBitFactory.CreateMockBits(0, 0, 0, 0, 0, 0, 0, 0)); Assert.NotNull(bitAggregate); }