public void Equals()
        {
            TimeStamp timeStamp1 = new TimeStamp(12345.3);

            Assert.IsTrue(timeStamp.Equals(timeStamp1));
            timeStamp1.ModifiedJulianDay = 34.0;
            Assert.IsFalse(timeStamp.Equals(timeStamp1));

            Assert.IsFalse(timeStamp.Equals(null));
            Assert.IsFalse(timeStamp.Equals("string"));
        }
Example #2
0
        public void TimeStampGenerator02()
        {
            var generator = new TimeStampGenerator();

            TimeStamp first    = generator.Next;
            TimeStamp next     = generator.Next;
            TimeStamp nextnext = generator.Next;

            Assert.IsTrue(first < next);
            Assert.IsTrue(first < nextnext);
            Assert.IsTrue(next < nextnext);

            Assert.IsTrue(next > first);
            Assert.IsTrue(nextnext > first);
            Assert.IsTrue(nextnext > next);

            // Alisasing the variable is necessary to prevent
            // the compiler's naive comparison check preventing this
            TimeStamp a = first;

            Assert.IsFalse(a > first);
            Assert.IsFalse(a < first);
            Assert.IsTrue(a.Equals(first));
            Assert.IsTrue(first.Equals(a));

            TimeStamp b = next;

            Assert.IsFalse(b > next);
            Assert.IsFalse(b < next);
            Assert.IsTrue(b.Equals(next));
            Assert.IsTrue(next.Equals(b));
        }
Example #3
0
        public bool Equals(SimpleVariables other)
        {
            if (other == null)
            {
                return(false);
            }

            return(CurrentLevel.Equals(other.CurrentLevel) &&
                   CurrentArea.Equals(other.CurrentArea) &&
                   Language.Equals(other.Language) &&
                   MillisecondsPerGameMinute.Equals(other.MillisecondsPerGameMinute) &&
                   LastClockTick.Equals(other.LastClockTick) &&
                   GameClockHours.Equals(other.GameClockHours) &&
                   GameClockMinutes.Equals(other.GameClockMinutes) &&
                   GameClockSeconds.Equals(other.GameClockSeconds) &&
                   TimeInMilliseconds.Equals(other.TimeInMilliseconds) &&
                   TimeScale.Equals(other.TimeScale) &&
                   TimeStep.Equals(other.TimeStep) &&
                   TimeStepNonClipped.Equals(other.TimeStepNonClipped) &&
                   FramesPerUpdate.Equals(other.FramesPerUpdate) &&
                   FrameCounter.Equals(other.FrameCounter) &&
                   OldWeatherType.Equals(other.OldWeatherType) &&
                   NewWeatherType.Equals(other.NewWeatherType) &&
                   ForcedWeatherType.Equals(other.ForcedWeatherType) &&
                   WeatherTypeInList.Equals(other.WeatherTypeInList) &&
                   WeatherInterpolationValue.Equals(other.WeatherInterpolationValue) &&
                   CameraPosition.Equals(other.CameraPosition) &&
                   CameraModeInCar.Equals(other.CameraModeInCar) &&
                   CameraModeOnFoot.Equals(other.CameraModeOnFoot) &&
                   ExtraColor.Equals(other.ExtraColor) &&
                   IsExtraColorOn.Equals(other.IsExtraColorOn) &&
                   ExtraColorInterpolation.Equals(other.ExtraColorInterpolation) &&
                   Brightness.Equals(other.Brightness) &&
                   DisplayHud.Equals(other.DisplayHud) &&
                   ShowSubtitles.Equals(other.ShowSubtitles) &&
                   RadarMode.Equals(other.RadarMode) &&
                   BlurOn.Equals(other.BlurOn) &&
                   UseWideScreen.Equals(other.UseWideScreen) &&
                   MusicVolume.Equals(other.MusicVolume) &&
                   SfxVolume.Equals(other.SfxVolume) &&
                   RadioStation.Equals(other.RadioStation) &&
                   StereoOutput.Equals(other.StereoOutput) &&
                   PadMode.Equals(other.PadMode) &&
                   InvertLook.Equals(other.InvertLook) &&
                   UseVibration.Equals(other.UseVibration) &&
                   SwapNippleAndDPad.Equals(other.SwapNippleAndDPad) &&
                   HasPlayerCheated.Equals(other.HasPlayerCheated) &&
                   AllTaxisHaveNitro.Equals(other.AllTaxisHaveNitro) &&
                   TargetIsOn.Equals(other.TargetIsOn) &&
                   TargetPosition.Equals(other.TargetPosition) &&
                   PlayerPosition.Equals(other.PlayerPosition) &&
                   TrailsOn.Equals(other.TrailsOn) &&
                   TimeStamp.Equals(other.TimeStamp) &&
                   Unknown78hPS2.Equals(other.Unknown78hPS2) &&
                   Unknown7ChPS2.Equals(other.Unknown7ChPS2) &&
                   Unknown90hPS2.Equals(other.Unknown90hPS2) &&
                   UnknownB8hPSP.Equals(other.UnknownB8hPSP) &&
                   UnknownD8hPS2.Equals(other.UnknownD8hPS2) &&
                   UnknownD9hPS2.Equals(other.UnknownD9hPS2));
        }
Example #4
0
 public bool Equals(SummaryEntry other)
 {
     return(other != null &&
            TimeStamp.Equals(other.TimeStamp) &&
            SystemName == null ? other.SystemName == null : SystemName.Equals(other.SystemName) &&
            IncreasesInfluence == other.IncreasesInfluence);
 }
Example #5
0
 /// <summary>
 /// Compares internal data for equality.
 /// </summary>
 /// <param name="b"></param>
 /// <returns></returns>
 public bool Equals(Header b)
 {
     if (pDUType != b.pDUType)
     {
         return(false);
     }
     if (protocolVersion != b.protocolVersion)
     {
         return(false);
     }
     if (exerciseID != b.exerciseID)
     {
         return(false);
     }
     if (protocolFamily != b.protocolFamily)
     {
         return(false);
     }
     if (!timeStamp.Equals(b.timeStamp))
     {
         return(false);
     }
     if (length != b.length)
     {
         return(false);
     }
     return(true);
 }
Example #6
0
 public bool Equals(BlockInfo other)
 {
     return(Hash == other.Hash &&
            PreviousHash == other.PreviousHash &&
            Nonce == other.Nonce &&
            TimeStamp.Equals(other.TimeStamp) &&
            Equals(Transactions, other.Transactions));
 }
Example #7
0
 public bool Equals(CircuitBreakerStateDescriptor other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(State == other.State && TimeToLive.Equals(other.TimeToLive) && TimeStamp.Equals(other.TimeStamp));
 }
        public bool Equals(SimpleVariables other)
        {
            if (other == null)
            {
                return(false);
            }

            return(LastMissionPassedName.Equals(other.LastMissionPassedName) &&
                   TimeStamp.Equals(other.TimeStamp) &&
                   SizeOfGameInBytes.Equals(other.SizeOfGameInBytes) &&
                   CurrentLevel.Equals(other.CurrentLevel) &&
                   CameraPosition.Equals(other.CameraPosition) &&
                   MillisecondsPerGameMinute.Equals(other.MillisecondsPerGameMinute) &&
                   LastClockTick.Equals(other.LastClockTick) &&
                   GameClockHours.Equals(other.GameClockHours) &&
                   GameClockMinutes.Equals(other.GameClockMinutes) &&
                   CurrPadMode.Equals(other.CurrPadMode) &&
                   TimeInMilliseconds.Equals(other.TimeInMilliseconds) &&
                   TimeScale.Equals(other.TimeScale) &&
                   TimeStep.Equals(other.TimeStep) &&
                   TimeStepNonClipped.Equals(other.TimeStepNonClipped) &&
                   FrameCounter.Equals(other.FrameCounter) &&
                   TimeStep2.Equals(other.TimeStep2) &&
                   FramesPerUpdate.Equals(other.FramesPerUpdate) &&
                   TimeScale2.Equals(other.TimeScale2) &&
                   OldWeatherType.Equals(other.OldWeatherType) &&
                   NewWeatherType.Equals(other.NewWeatherType) &&
                   ForcedWeatherType.Equals(other.ForcedWeatherType) &&
                   WeatherInterpolation.Equals(other.WeatherInterpolation) &&
                   MusicVolume.Equals(other.MusicVolume) &&
                   SfxVolume.Equals(other.SfxVolume) &&
                   UseVibration.Equals(other.UseVibration) &&
                   StereoOutput.Equals(other.StereoOutput) &&
                   RadioStation.Equals(other.RadioStation) &&
                   Brightness.Equals(other.Brightness) &&
                   ShowSubtitles.Equals(other.ShowSubtitles) &&
                   Language.Equals(other.Language) &&
                   UseWideScreen.Equals(other.UseWideScreen) &&
                   BlurOn.Equals(other.BlurOn) &&
                   CompileDateAndTime.Equals(other.CompileDateAndTime) &&
                   WeatherTypeInList.Equals(other.WeatherTypeInList) &&
                   CameraModeInCar.Equals(other.CameraModeInCar) &&
                   CameraModeOnFoot.Equals(other.CameraModeOnFoot) &&
                   IsQuickSave.Equals(other.IsQuickSave));
        }
Example #9
0
            public override bool Equals(object o)
            {
                if (o == null || GetType() != o.GetType())
                {
                    return(false);
                }

                var p = (TimeStampKey)o;

                if (!TimeStamp.Equals(p.TimeStamp))
                {
                    return(false);
                }
                if (!_minorOrder.Equals(p._minorOrder))
                {
                    return(false);
                }
                return(true);
            }
Example #10
0
        public bool Equals(SimpleVariables other)
        {
            if (other == null)
            {
                return(false);
            }

            return(SaveVersionNumber.Equals(other.SaveVersionNumber) &&
                   LastMissionPassedName.Equals(other.LastMissionPassedName) &&
                   TimeStamp.Equals(other.TimeStamp) &&
                   SizeOfGameInBytes.Equals(other.SizeOfGameInBytes) &&
                   CurrLevel.Equals(other.CurrLevel) &&
                   CameraPosition.Equals(other.CameraPosition) &&
                   SteamMagicNumber.Equals(other.SteamMagicNumber) &&
                   MillisecondsPerGameMinute.Equals(other.MillisecondsPerGameMinute) &&
                   LastClockTick.Equals(other.LastClockTick) &&
                   GameClockHours.Equals(other.GameClockHours) &&
                   GameClockMinutes.Equals(other.GameClockMinutes) &&
                   CurrPadMode.Equals(other.CurrPadMode) &&
                   TimeInMilliseconds.Equals(other.TimeInMilliseconds) &&
                   TimerTimeScale.Equals(other.TimerTimeScale) &&
                   TimerTimeStep.Equals(other.TimerTimeStep) &&
                   TimerTimeStepNonClipped.Equals(other.TimerTimeStepNonClipped) &&
                   FrameCounter.Equals(other.FrameCounter) &&
                   TimeStep.Equals(other.TimeStep) &&
                   FramesPerUpdate.Equals(other.FramesPerUpdate) &&
                   TimeScale.Equals(other.TimeScale) &&
                   OldWeatherType.Equals(other.OldWeatherType) &&
                   NewWeatherType.Equals(other.NewWeatherType) &&
                   ForcedWeatherType.Equals(other.ForcedWeatherType) &&
                   WeatherInterpolation.Equals(other.WeatherInterpolation) &&
                   WeatherTypeInList.Equals(other.WeatherTypeInList) &&
                   CameraCarZoomIndicator.Equals(other.CameraCarZoomIndicator) &&
                   CameraPedZoomIndicator.Equals(other.CameraPedZoomIndicator) &&
                   CurrArea.Equals(other.CurrArea) &&
                   AllTaxisHaveNitro.Equals(other.AllTaxisHaveNitro) &&
                   InvertLook4Pad.Equals(other.InvertLook4Pad) &&
                   ExtraColour.Equals(other.ExtraColour) &&
                   ExtraColourOn.Equals(other.ExtraColourOn) &&
                   ExtraColourInterpolation.Equals(other.ExtraColourInterpolation) &&
                   RadioStationPositionList.SequenceEqual(other.RadioStationPositionList));
        }
Example #11
0
 protected bool Equals(ItemData other)
 {
     return(Id == other.Id && TimeStamp.Equals(other.TimeStamp) && string.Equals(RealmSlug, other.RealmSlug) && MeanValue.Equals(other.MeanValue) && AdjustedMeanValue.Equals(other.AdjustedMeanValue) && LowestValue.Equals(other.LowestValue) && HighestValue.Equals(other.HighestValue) && Quantity == other.Quantity);
 }
Example #12
0
 public void TestCapturedDataMatchesProvider()
 {
     Assert.Ignore();
     try
     {
         var config = CreateSimulateConfig();
         StarterConfigView form;
         StartGUI(config, out form);
         config.SymbolList = "/ESZ9";
         StrategyBaseTest.CleanupFiles(config.SymbolList, null);
         config.DefaultPeriod  = 1;
         config.DefaultBarUnit = BarUnit.Minute.ToString();
         config.EndDateTime    = DateTime.UtcNow;
         config.ModelLoader    = "Example: Reversal Multi-Symbol";
         config.StarterName    = "FIXSimulatorStarter";
         config.Start();
         config.WaitComplete(short.MaxValue);
         config.Stop();
         config.WaitComplete(1200, () => { return(!config.CommandWorker.IsBusy); });
         Assert.IsFalse(config.CommandWorker.IsBusy, "ProcessWorker.Busy");
         string appData      = Factory.Settings["AppDataFolder"];
         string compareFile1 = appData + @"\Test\MockProviderData\ESZ9.tck";
         string compareFile2 = appData + @"\Test\ServerCache\ESZ9.tck";
         using (var reader1 = Factory.TickUtil.TickFile()) {
             reader1.Initialize(compareFile1, config.SymbolList, TickFileMode.Read);
             var tickIO = Factory.TickUtil.TickIO();
             try {
                 int count = 0;
                 while (reader1.TryReadTick(tickIO))
                 {
                     count++;
                 }
             } catch (QueueException ex) {
                 Assert.IsTrue(ex.EntryType == EventType.StartHistorical || ex.EntryType == EventType.EndHistorical, "start or end historical");
             }
         }
         using (var reader1 = Factory.TickUtil.TickFile())
             using (var reader2 = Factory.TickUtil.TickFile()) {
                 reader1.Initialize(compareFile1, TickFileMode.Read);
                 reader2.Initialize(compareFile2, TickFileMode.Read);
                 var  tickIO1 = Factory.TickUtil.TickIO();
                 var  tickIO2 = Factory.TickUtil.TickIO();
                 bool result  = true;
                 int  count   = 0;
                 while (reader1.TryReadTick(tickIO1) && reader2.TryReadTick(tickIO2))
                 {
                     TimeStamp ts1 = new TimeStamp(tickIO1.UtcTime);
                     TimeStamp ts2 = new TimeStamp(tickIO2.UtcTime);
                     if (!ts1.Equals(ts2))
                     {
                         result = false;
                         log.Error("Tick# " + count + " failed. Expected: " + ts1 + ", But was:" + ts2);
                     }
                     count++;
                 }
                 Assert.IsTrue(result, "Tick mismatch errors. See log file.");
             }
     } catch (Exception ex) {
         log.Error("Test failed with error: " + ex.Message, ex);
         Environment.Exit(1);
     }
     finally
     {
         Factory.Release();
     }
 }
Example #13
0
 public void TestCapturedDataMatchesProvider()
 {
     try {
         using (var config = CreateSimulateConfig()) {
             config.SymbolList     = "/ESZ9";
             config.DefaultPeriod  = 1;
             config.DefaultBarUnit = BarUnit.Minute.ToString();
             config.EndDateTime    = DateTime.UtcNow;
             config.ModelLoader    = "Example: Reversal Multi-Symbol";
             config.StarterName    = "TestRealTimeStarter";
             config.Start();
             config.WaitComplete(10);
             config.Stop();
             config.WaitComplete(120, () => { return(!config.CommandWorker.IsBusy); });
             Assert.IsFalse(config.CommandWorker.IsBusy, "ProcessWorker.Busy");
             string appData      = Factory.Settings["AppDataFolder"];
             string compareFile1 = appData + @"\Test\MockProviderData\ESZ9.tck";
             string compareFile2 = appData + @"\Test\ServerCache\ESZ9.tck";
             using (TickReader reader1 = Factory.TickUtil.TickReader()) {
                 reader1.Initialize(compareFile1, config.SymbolList);
                 TickBinary tick1 = new TickBinary();
                 try {
                     int count = 0;
                     while (true)
                     {
                         while (!reader1.ReadQueue.TryDequeue(ref tick1))
                         {
                             Thread.Sleep(1);
                         }
                         TimeStamp ts1 = new TimeStamp(tick1.UtcTime);
                         count++;
                     }
                 } catch (QueueException ex) {
                     Assert.AreEqual(ex.EntryType, EventType.EndHistorical);
                 }
             }
             using (TickReader reader1 = Factory.TickUtil.TickReader())
                 using (TickReader reader2 = Factory.TickUtil.TickReader()) {
                     reader1.Initialize(compareFile1, config.SymbolList);
                     reader2.Initialize(compareFile2, config.SymbolList);
                     TickBinary tick1  = new TickBinary();
                     TickBinary tick2  = new TickBinary();
                     bool       result = true;
                     try {
                         int count = 0;
                         while (true)
                         {
                             while (!reader1.ReadQueue.TryDequeue(ref tick1))
                             {
                                 Thread.Sleep(1);
                             }
                             while (!reader2.ReadQueue.TryDequeue(ref tick2))
                             {
                                 Thread.Sleep(1);
                             }
                             TimeStamp ts1 = new TimeStamp(tick1.UtcTime);
                             TimeStamp ts2 = new TimeStamp(tick2.UtcTime);
                             if (!ts1.Equals(ts2))
                             {
                                 result = false;
                                 log.Error("Tick# " + count + " failed. Expected: " + ts1 + ", But was:" + ts2);
                             }
                             count++;
                         }
                     } catch (QueueException ex) {
                         Assert.AreEqual(ex.EntryType, EventType.EndHistorical);
                     }
                     Assert.IsTrue(result, "Tick mismatch errors. See log file.");
                 }
         }
     } catch (Exception ex) {
         log.Error("Test failed with error: " + ex.Message, ex);
         Environment.Exit(1);
     }
 }