Beispiel #1
0
        public void RunInit_Completes()
        {
            var data = TestUtils.CreateBikeSession();
            var ptr  = Marshal.AllocHGlobal(Marshal.SizeOf(data));

            Marshal.StructureToPtr(data, ptr, true);

            var msgReceived = false;

            using (var rec = new BikeDataReceiver(BroadcastPort))
            {
                var recData = new GPBikes.SPluginsBikeSession_t();
                rec.OnRunInit += (sender, args) =>
                {
                    msgReceived = true;
                    recData     = args.Data;
                };

                RunInit(ptr, default(int));

                while (!msgReceived)
                {
                    Thread.Sleep(100);
                }

                TestUtils.AssertAreEqual(recData, data);
            }
        }
Beispiel #2
0
 public static void AssertAreEqual(BikeSession recData, GPBikes.SPluginsBikeSession_t data)
 {
     Assert.AreEqual(recData.Session, data.Session);
     Assert.AreEqual(recData.Conditions, data.Conditions);
     Assert.AreEqual(recData.AirTemperature, data.AirTemperature);
     Assert.AreEqual(recData.TrackTemperature, data.TrackTemperature);
     Assert.AreEqual(recData.SetupFileName, data.SetupFileName);
 }
Beispiel #3
0
        public static GPBikes.SPluginsBikeSession_t CreateBikeSession()
        {
            var data = new GPBikes.SPluginsBikeSession_t
            {
                Session          = 4,
                Conditions       = 2,
                AirTemperature   = 21,
                TrackTemperature = 30,
                SetupFileName    = "RainTyres"
            };

            return(data);
        }
        public void OnRunInit(GPBikes.SPluginsBikeSession_t data)
        {
            var msg = ObjectToByteArray(data);

            SendMessage(msg);
        }