コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
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);
        }
コード例 #4
0
        public void Constructor_EmptyInput_ThrowsException()
        {
            Action action = () => { new BitAggregate(MockBitFactory.CreateMockBits()); };

            Assert.Throws <ArgumentOutOfRangeException>(action);
        }
コード例 #5
0
        public void Constructor_ValidInput_ReturnsBitAggregate()
        {
            var bitAggregate = new BitAggregate(MockBitFactory.CreateMockBits(0, 0, 0, 0, 0, 0, 0, 0));

            Assert.NotNull(bitAggregate);
        }