Example #1
0
        public void Parsed_EmptyInput_NullOutput()
        {
            // Arrange
            STTInterpreter stt = new STTInterpreter();

            byte[] arr = new byte[0];

            // Act
            ServiceInfo[] array = stt.Parse(arr);

            // Assert
            Assert.AreEqual(null, array);
        }
Example #2
0
        public void ToBytes_40ServicesInput_10BytesOutput()
        {
            // Arrange
            STTInterpreter stt = new STTInterpreter();

            ServiceInfo[] array = generateServiceInfoArray(40, true, true);

            // Act
            byte[] output = stt.ToBytes(array);

            // Assert
            Assert.AreEqual(10, output.Length);
        }
Example #3
0
        public void ToBytes_4ServicesInput_NullOutput()
        {
            // Arrange
            STTInterpreter stt = new STTInterpreter();

            ServiceInfo[] array = generateServiceInfoArray(4, true, true);

            // Act
            byte[] output = stt.ToBytes(array);

            // Assert
            Assert.AreEqual(null, output);
        }
Example #4
0
        public void ToBytes_EmptyInput_NullOutput()
        {
            // Arrange
            STTInterpreter stt = new STTInterpreter();

            ServiceInfo[] array = new ServiceInfo[0];

            // Act
            byte[] output = stt.ToBytes(array);

            // Assert
            Assert.AreEqual(null, output);
        }
Example #5
0
        public void Parsed_10BytesInput_40ServicesOutput()
        {
            // Arrange
            STTInterpreter stt = new STTInterpreter();

            byte[] arr = new byte[10] {
                201, 192, 127, 97, 58, 48, 223, 235, 96, 23
            };

            // Act
            ServiceInfo[] array = stt.Parse(arr);

            // Assert
            Assert.AreEqual(40, array.Length);
        }
Example #6
0
        public void Parsed_2BytesInput_8ServicesOutput()
        {
            // Arrange
            STTInterpreter stt = new STTInterpreter();

            byte[] arr = new byte[2] {
                100, 120
            };

            // Act
            ServiceInfo[] array = stt.Parse(arr);

            // Assert
            Assert.AreEqual(8, array.Length);
        }
Example #7
0
        public void ToBytes_ServicesNotAllocatedNorActivated_AllBytesZero()
        {
            // Arrange
            STTInterpreter stt = new STTInterpreter();

            ServiceInfo[] array = generateServiceInfoArray(40, false, false);

            // Act
            byte[] output = stt.ToBytes(array);

            // Assert
            foreach (byte b in output)
            {
                Assert.AreEqual(0, b);
            }
        }
Example #8
0
        public void ToBytes_ServicesAllocatednActivated_AllBytesOne()
        {
            // Arrange
            STTInterpreter stt = new STTInterpreter();

            ServiceInfo[] array = generateServiceInfoArray(40, true, true);

            // Act
            byte[] output = stt.ToBytes(array);

            // Assert
            foreach (byte b in output)
            {
                Assert.AreEqual(255, b);
            }
        }
Example #9
0
        public void Parsed_2BytesInput_8ServicesMandatory()
        {
            // Arrange
            STTInterpreter stt = new STTInterpreter();

            byte[] arr = new byte[2] {
                201, 192
            };

            // Act
            ServiceInfo[] array = stt.Parse(arr);

            // Assert
            foreach (ServiceInfo service in array)
            {
                Assert.IsTrue(service.isMandatory);
            }
        }
Example #10
0
        public void Parsed_BytesInputAllOnes_AllServicesAllocatedAndActivated()
        {
            // Arrange
            STTInterpreter stt = new STTInterpreter();

            byte[] arr = new byte[5] {
                255, 255, 255, 255, 255
            };

            // Act
            ServiceInfo[] array = stt.Parse(arr);

            // Assert
            foreach (ServiceInfo service in array)
            {
                Assert.IsTrue(service.isAllocated);
                Assert.IsTrue(service.isActivated);
            }
        }
Example #11
0
        public void Parsed_BytesInputAllZeros_ServicesNotAllocatedNorActivated()
        {
            // Arrange
            STTInterpreter stt = new STTInterpreter();

            byte[] arr = new byte[5] {
                0, 0, 0, 0, 0
            };

            // Act
            ServiceInfo[] array = stt.Parse(arr);

            // Assert
            foreach (ServiceInfo service in array)
            {
                Assert.IsFalse(service.isAllocated);
                Assert.IsFalse(service.isActivated);
            }
        }