示例#1
0
        public void NormalInputTest(byte[] input, int expectedCodeLength, int expectedNumberOfCodesToGenerate)
        {
            var encoder = new DataEncoder();

            var memStream = new MemoryStream();

            memStream.Write(input, 0, input.Length);
            memStream.Seek(0, SeekOrigin.Begin);
            var requestData = encoder.DecodeGenerateRequest(memStream);

            Assert.AreEqual(expectedCodeLength, requestData.CodeLength);
        }
示例#2
0
        public void TooShortCodesRequestedTest()
        {
            var encoder = new DataEncoder();

            var memStream = new MemoryStream();

            memStream.Write(new byte[] { 0, 1, 6 }, 0, 3);
            memStream.Seek(0, SeekOrigin.Begin);
            var requestData = encoder.DecodeGenerateRequest(memStream);

            Assert.AreEqual(6, requestData.CodeLength);
            Assert.AreEqual(0, requestData.NumberOfCodesToGenerate);
        }