public void WithMessage_GreaterThan_TotalNumberOfBits_ChoosenToBeUsed_Then_ArgumentException_IsThrown(
            SutMessageToByteBufferWriter sut)
        {
            //a
            var    messageStub            = "Test message";
            var    targetByteBuffer       = new byte[4];
            ushort numberOfBitstoUseDummy = 1;

            //aa
            Action writeMessageCall = () => sut.WriteMessage(messageStub, targetByteBuffer, numberOfBitstoUseDummy);

            //aaa
            writeMessageCall.ShouldThrowExactly <ArgumentException>();
        }
        public void WithNull_TargetArray_Then_ArgumentNullException_IsThrown(
            string messageDummy,
            SutMessageToByteBufferWriter sut)
        {
            //a
            byte[] nullByteBuffer         = null;
            ushort numberOfBitstoUseDummy = 1;

            //aa
            Action writeMessageCall = () => sut.WriteMessage(messageDummy, nullByteBuffer, numberOfBitstoUseDummy);

            //aaa
            writeMessageCall.ShouldThrowExactly <ArgumentNullException>();
        }
        public void WithNull_Message_Then_ArgumentNullException_IsThrown(
            byte[] byteArrayDumy,
            SutMessageToByteBufferWriter sut)
        {
            //a
            string nullMessageStub        = null;
            ushort numberOfBitstoUseDummy = 1;

            //aa
            Action writeMessageCall = () => sut.WriteMessage(nullMessageStub, byteArrayDumy, numberOfBitstoUseDummy);

            //aaa
            writeMessageCall.ShouldThrowExactly <ArgumentNullException>();
        }
        public void Then_NoException_IsThrown(
            SutMessageToByteBufferWriter sut)
        {
            //a
            var    messageStub            = "Abc";
            var    byteBufferStub         = new byte[24];
            ushort numberOfBitstoUseDummy = 1;

            //aa
            Action writeMessageCall = () => sut.WriteMessage(messageStub, byteBufferStub, numberOfBitstoUseDummy);

            //aaa
            writeMessageCall.ShouldNotThrow();
        }
        public void Then_MessageWriteResult_HasCorrect_TotalNumberOfBytesUsed(
            SutMessageToByteBufferWriter sut)
        {
            //a
            var    messageStub           = "Abc";
            var    targetByteBuffer      = new byte[24];
            ushort numberOfBitsToUseStub = 5;

            var  numberOfBitsInMessage          = messageStub.Length * 8;
            uint expectedTotalNumberOfBytesUsed = (uint)Math.Ceiling((decimal)numberOfBitsInMessage / numberOfBitsToUseStub);

            //aa
            var writeResult = sut.WriteMessage(messageStub, targetByteBuffer, numberOfBitsToUseStub);

            //aaa
            writeResult.TotalNumberOfBytesUsed.Should().Be(expectedTotalNumberOfBytesUsed);
        }
        public void Then_ProvidedMessage_IsStored_InReturned_MessageWriteResult_Buffer(
            Domain.Writers.BitToByteWriter bitToByteWriterStub)
        {
            //a
            var    messageStub           = "Abc";
            var    targetByteBuffer      = new byte[24];
            ushort numberOfBitstoUseStub = 2;
            var    sut = new SutMessageToByteBufferWriter(bitToByteWriterStub);

            //aa
            var writeResult = sut.WriteMessage(messageStub, targetByteBuffer, numberOfBitstoUseStub);

            //aaa
            var messageRetrieved = ReadFromWriteResult(writeResult);

            messageRetrieved.Should().Be(messageStub);
        }