public void ValidateCurrentIndex_WhenCalledForResponseWithWrongValue_ShouldReturnFalse() { _sut = new IndexerCalculator(true); byte firstByte = 0b1111_0000; var validationResult = _sut.ValidateCurrentIndex(firstByte); Assert.False(validationResult); }
public void ValidateCurrentIndex_WhenCalledForRequestAfterGenerateIndexToSend_ShouldSendNextValue(byte data, bool expectedResult) { _sut = new IndexerCalculator(false); _sut.GenerateIndexToSend(0b1000_0000); var validationResult = _sut.ValidateCurrentIndex(data); Assert.Equal(expectedResult, validationResult); }
public void GenerateIndexToSend_WhenCalledForRequestAfterValidate_ShouldSendSameValue() { _sut = new IndexerCalculator(false); byte firstByte = 0b1111_0000; var validationResult = _sut.ValidateCurrentIndex(firstByte); var result = _sut.GenerateIndexToSend(firstByte); Assert.True(validationResult); Assert.Equal(0b1111_0001, result); }
public void GenerateIndexToSend_WhenCalledForRequest_ShouldBeValidOnResponce( int requestCurrentIndex, int responseCurrentIndex, bool expectedResult) { var requestCalculator = new IndexerCalculator(false, requestCurrentIndex); var responseCalculator = new IndexerCalculator(true, responseCurrentIndex); byte firstByte = Session.REQUEST; var indexToSend = requestCalculator.GenerateIndexToSend(firstByte); var temp = ByteToString(indexToSend); var result = responseCalculator.ValidateCurrentIndex(indexToSend); Assert.Equal(expectedResult, result); }