Exemplo n.º 1
0
        public void SetValueString_ThrowsOperationCanceledException_InputLengthIsIncorrect()
        {
            // Arrange
            var bitset = new IntegerBitset();

            // Act
            void Result() => bitset.SetValue("10110101");

            // Assert
            Assert.Throws <OperationCanceledException>(Result);
        }
Exemplo n.º 2
0
        public void SetValueString_ThrowsArgumentNullException_InputIsNull()
        {
            // Arrange
            var bitset = new IntegerBitset();

            // Act
            void Result() => bitset.SetValue((string)null);

            // Assert
            Assert.Throws <ArgumentNullException>(Result);
        }
Exemplo n.º 3
0
        public void SetValueBitArray_ThrowsOperationCanceledException_InputLengthIsIncorrect()
        {
            // Arrange
            var bitset = new IntegerBitset();

            // Act
            void Result() => bitset.SetValue(new BitArray(new byte[] { 7 }));

            // Assert
            Assert.Throws <OperationCanceledException>(Result);
        }
Exemplo n.º 4
0
        public void SetValueString_Passes_InputIsCorrect()
        {
            // Arrange
            var bitset = new IntegerBitset();

            // Act
            bitset.SetValue("00000000000000000000000000000111");

            // Assert
            Assert.Equal(7, bitset.GetInt32());
        }
Exemplo n.º 5
0
        public void SetValueBitArray_Passes_InputIsCorrect()
        {
            // Arrange
            var bitset = new IntegerBitset();

            // Act
            bitset.SetValue(new BitArray(new [] { 8 }));

            // Assert
            Assert.Equal(8, bitset.GetInt32());
        }