예제 #1
0
        public void Should_serialize_StaticAndVoyageRelatedDataMessage()
        {
            var faker      = new Faker();
            var aisMessage = new StaticAndVoyageRelatedDataMessage
            {
                Repeat               = faker.Random.UInt(),
                Mmsi                 = faker.Random.UInt(),
                AisVersion           = faker.Random.UInt(),
                ImoNumber            = faker.Random.UInt(),
                CallSign             = faker.Lorem.Word(),
                ShipName             = faker.Lorem.Word(),
                ShipType             = faker.PickRandom <ShipType>(),
                DimensionToBow       = faker.Random.UInt(),
                DimensionToStern     = faker.Random.UInt(),
                DimensionToPort      = faker.Random.UInt(),
                DimensionToStarboard = faker.Random.UInt(),
                PositionFixType      = faker.PickRandom <PositionFixType>(),
                EtaMonth             = faker.Random.UInt(1, 12),
                EtaDay               = faker.Random.UInt(1, 31),
                EtaHour              = faker.Random.UInt(0, 23),
                EtaMinute            = faker.Random.UInt(0, 59),
                Draught              = faker.Random.Double(),
                Destination          = faker.Lorem.Word(),
                DataTerminalReady    = faker.Random.Bool(),
                Spare                = faker.Random.UInt()
            };

            var deserializedAisMessage = Serialize(aisMessage);

            deserializedAisMessage.ShouldNotBeNull();
            deserializedAisMessage.MessageType.ShouldBe(AisMessageType.StaticAndVoyageRelatedData);
            deserializedAisMessage.Repeat.ShouldBe(aisMessage.Repeat);
            deserializedAisMessage.Mmsi.ShouldBe(aisMessage.Mmsi);
            deserializedAisMessage.AisVersion.ShouldBe(aisMessage.AisVersion);
            deserializedAisMessage.ImoNumber.ShouldBe(aisMessage.ImoNumber);
            deserializedAisMessage.CallSign.ShouldBe(aisMessage.CallSign);
            deserializedAisMessage.ShipName.ShouldBe(aisMessage.ShipName);
            deserializedAisMessage.ShipType.ShouldBe(aisMessage.ShipType);
            deserializedAisMessage.DimensionToBow.ShouldBe(aisMessage.DimensionToBow);
            deserializedAisMessage.DimensionToStern.ShouldBe(aisMessage.DimensionToStern);
            deserializedAisMessage.DimensionToPort.ShouldBe(aisMessage.DimensionToPort);
            deserializedAisMessage.DimensionToStarboard.ShouldBe(aisMessage.DimensionToStarboard);
            deserializedAisMessage.PositionFixType.ShouldBe(aisMessage.PositionFixType);
            deserializedAisMessage.EtaMonth.ShouldBe(aisMessage.EtaMonth);
            deserializedAisMessage.EtaDay.ShouldBe(aisMessage.EtaDay);
            deserializedAisMessage.EtaHour.ShouldBe(aisMessage.EtaHour);
            deserializedAisMessage.EtaMinute.ShouldBe(aisMessage.EtaMinute);
            deserializedAisMessage.Draught.ShouldBe(aisMessage.Draught);
            deserializedAisMessage.Destination.ShouldBe(aisMessage.Destination);
            deserializedAisMessage.DataTerminalReady.ShouldBe(aisMessage.DataTerminalReady);
            deserializedAisMessage.Spare.ShouldBe(aisMessage.Spare);
        }
예제 #2
0
파일: VesselData.cs 프로젝트: Gravicode/VTS
 public void AddShipData(StaticAndVoyageRelatedDataMessage item)
 {
     if (ShipDatas.ContainsKey(item.Mmsi))
     {
         ShipDatas[item.Mmsi].Add(item);
     }
     else
     {
         ShipDatas.Add(item.Mmsi, new List <AisMessage>()
         {
             item
         });
     }
 }