示例#1
0
        public static string GetSystemTimeString(int tmCid)
        {
            var tmcTime = new byte[80];

            Native.TmcSystemTime(tmCid, ref tmcTime, IntPtr.Zero);
            return(EncodingUtil.Win1251BytesToUtf8(tmcTime));
        }
示例#2
0
            public async void ReturnsCorrectTime([Frozen] ITmNative native, TmsApi tms)
            {
                Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

                var fakeTime   = "12.12.2017 09:14:30";
                var anyByteBuf = new byte[80];

                A.CallTo(() => native.TmcSystemTime(A <int> ._, ref anyByteBuf, A <IntPtr> ._))
                .WithAnyArguments()
                .AssignsOutAndRefParameters(Encoding.GetEncoding(1251).GetBytes(fakeTime));

                var result = await tms.GetSystemTime();

                result.Should().Be(new DateTime(2017, 12, 12, 9, 14, 30));
            }