Пример #1
0
        public void ReturnsNullNoSuchElement()
        {
            var sentence1 = new HeadingTrue(10.2);

            _sink.Raise(x => x.OnNewSequence += null, null, sentence1);

            Assert.Null(_cache.GetLastSentence(HeadingMagnetic.Id));
        }
Пример #2
0
        public void HdtEncode()
        {
            string msg = "99.9,T";

            NmeaSentence.OwnTalkerId = TalkerId.GlobalPositioningSystem;
            HeadingTrue mwv = new HeadingTrue(99.9);

            Assert.True(mwv.Valid);
            Assert.Equal(msg, mwv.ToNmeaParameterList());
        }
Пример #3
0
        public void CacheKeepsLastElement()
        {
            var sentence1 = new HeadingTrue(10.2);
            var sentence2 = new HeadingTrue(-1);

            _sink.Raise(x => x.OnNewSequence += null, null, sentence1);
            _sink.Raise(x => x.OnNewSequence += null, null, sentence2);

            Assert.Equal(sentence2, _cache.GetLastSentence(HeadingTrue.Id));
        }
Пример #4
0
        public void HdtDecode()
        {
            string msg = "$GPHDT,99.9,T";

            var decoded = TalkerSentence.FromSentenceString(msg, out var error);

            Assert.Equal(NmeaError.None, error);
            Assert.NotNull(decoded);

            HeadingTrue xte = (HeadingTrue)decoded !.TryGetTypedValue(ref _lastPacketTime) !;

            Assert.True(xte.Valid);
            Assert.Equal(99.9, xte.Angle.Degrees, 1);
        }