public void ReturnsEmptyListForEmptyChars()
            {
                char[] chars = { '\0' };

                var result = TmNativeUtil.GetStringListFromDoubleNullTerminatedChars(chars);

                result.Should().BeEmpty();
            }
            public void ReturnsCorrectForSingleNotTerminatedChars()
            {
                char[] chars = { 'D', 'u', 'm', 'm', 'y' };

                var result = TmNativeUtil.GetStringListFromDoubleNullTerminatedChars(chars);

                result.Should().Equal("Dummy");
            }
            public void ReturnsCorrectBytesTrimmingLongString()
            {
                string s = "Aaaaaa";

                var result = TmNativeUtil.GetFixedBytesWithTrailingZero(s, 4, "utf-8");

                result.Should().Equal(65, 97, 97, 0); // Aaa0
            }
            public void ReturnsEmptyListForNullChars()
            {
                var chars = new char[0];

                var result = TmNativeUtil.GetStringListFromDoubleNullTerminatedChars(chars);

                result.Should().BeEmpty();
            }
            public void ReturnsCorrectBytesFromShortString()
            {
                string s = "Aa";

                var result = TmNativeUtil.GetFixedBytesWithTrailingZero(s, 4, "utf-8");

                result.Should().Equal(65, 97, 0, 0); // Aa00
            }
            public void ThrowsArgumentExceptionForDataNull()
            {
                var tmcCommonPoint = new TmNativeDefs.TCommonPoint();

                Action act = () => TmNativeUtil.GetStatusPointFromCommonPoint(tmcCommonPoint);

                act.Should().Throw <ArgumentException>();
            }
            public void ReturnsCorrectForComplexChars()
            {
                char[] chars =
                {
                    'T', 'h', 'i',  's', '\0',
                    'i', 's', '\0',
                    't', 'e', 's',  't', '\0','\0',
                    't', 'r', 'a',  's', 'h',
                };

                var result = TmNativeUtil.GetStringListFromDoubleNullTerminatedChars(chars);

                result.Should().Equal("This", "is", "test");
            }
            public void SetsCorrectValues(float value, short flags, byte width, byte precision)
            {
                var tmAnalog       = new TmAnalog(0, 1, 1);
                var tmcCommonPoint = new TmNativeDefs.TCommonPoint
                {
                    TM_Flags = 1,
                    Data     = TmNativeUtil.GetBytes(new TmNativeDefs.TAnalogPoint
                    {
                        AsFloat = value,
                        Flags   = flags,
                        Format  = (byte)((precision << 4) | (width)),
                    }),
                };

                tmAnalog.FromTmcCommonPoint(tmcCommonPoint);

                Assert.True(tmAnalog.IsInit);
                Assert.Equal(value, tmAnalog.Value);
                Assert.Equal(flags, (short)tmAnalog.Flags);
                Assert.Equal(width, tmAnalog.Width);
                Assert.Equal(precision, tmAnalog.Precision);
            }
            public void ReturnsEmptyListForNull()
            {
                var result = TmNativeUtil.GetStringListFromDoubleNullTerminatedChars(null);

                result.Should().BeEmpty();
            }