Exemplo n.º 1
0
 public void CurrentFrameTest2()
 {
     var unitInfo = new UnitInfo();
      var unitFrame = new UnitFrame { FrameID = 0 };
      unitInfo.SetUnitFrame(unitFrame);
      Assert.AreSame(unitFrame, unitInfo.CurrentFrame);
 }
Exemplo n.º 2
0
 public void ComparisonTest3()
 {
    var frame1 = new UnitFrame();
    var frame2 = new UnitFrame();
    Assert.IsTrue(frame1.Equals(frame2));
    Assert.IsTrue(frame1.CompareTo(frame2) == 0);
 }
Exemplo n.º 3
0
 public void CurrentFrameTest4()
 {
     var unitInfo = new UnitInfo();
      var unitFrame = new UnitFrame { FrameID = -1 };
      unitInfo.SetUnitFrame(unitFrame);
      Assert.IsNull(unitInfo.CurrentFrame);
 }
Exemplo n.º 4
0
 public void ComparisonTest5()
 {
    var frame1 = new UnitFrame();
    var frame2 = new UnitFrame { FrameID = 1 };
    Assert.IsFalse(frame1.Equals(frame2));
    Assert.IsTrue(frame1.CompareTo(frame2) < 0);
 }
Exemplo n.º 5
0
 public void ComparisonTest12()
 {
     var frame1 = new UnitFrame { FrameDuration = TimeSpan.FromMinutes(2) };
      var frame2 = new UnitFrame { FrameDuration = TimeSpan.FromMinutes(1) };
      Assert.IsFalse(frame1.Equals(frame2));
      Assert.IsTrue(frame1.CompareTo(frame2) > 0);
 }
Exemplo n.º 6
0
        public void ComparisonTest13()
        {
            var frame1 = new UnitFrame();

            Assert.IsFalse(frame1.Equals(null));
            Assert.IsTrue(frame1.CompareTo(null) > 0);
        }
Exemplo n.º 7
0
    void Update()
    {
        UnitFrame?.Move(this);
        if (false && UnitFrame.NextMove?.MoveType == MoveType.Add)
        {
            Position FinalDestination = UnitFrame.NextMove.Positions[UnitFrame.NextMove.Positions.Count - 1];
            HexCell  targetCell       = UnitFrame.HexGrid.GroundCells[FinalDestination];

            Vector3 unitPos3 = targetCell.Cell.transform.localPosition;
            unitPos3.y += UnitFrame.HexGrid.hexCellHeight + AboveGround;

            transform.position = Vector3.MoveTowards(transform.position, unitPos3, 1);
        }
        else if (UnitFrame.NextMove?.MoveType == MoveType.Move || UnitFrame.NextMove?.MoveType == MoveType.Add)
        {
            Position FinalDestination = UnitFrame.NextMove.Positions[UnitFrame.NextMove.Positions.Count - 1];
            HexCell  targetCell       = UnitFrame.HexGrid.GroundCells[FinalDestination];

            Vector3 unitPos3 = targetCell.Cell.transform.localPosition;
            unitPos3.y += UnitFrame.HexGrid.hexCellHeight + AboveGround;

            if (UnitFrame.NextMove.Positions.Count > 0)
            {
                float speed = 1.75f / UnitFrame.HexGrid.GameSpeed;
                float step  = speed * Time.deltaTime;

                transform.position = Vector3.MoveTowards(transform.position, unitPos3, step);
                UpdateDirection(unitPos3);
            }
            else
            {
                transform.position = Vector3.MoveTowards(transform.position, unitPos3, 1);
            }
        }
    }
Exemplo n.º 8
0
 public void Initialize()
 {
     slider        = transform.GetComponent <Slider>();
     lastValue     = int.MinValue;
     UnitFrame     = gameObject.transform.GetComponentInParent <UnitFrame>();
     ValueChanged += OnValueChanged;
 }
Exemplo n.º 9
0
        public void UnitInfo_CurrentFrame_Test3()
        {
            // Arrange
            var unitInfo = new UnitInfo();
            var logLine0 = new LogLine {
                LineType = LogLineType.WorkUnitFrame, LineData = new UnitFrame {
                    FrameID = 0
                }
            };
            var logLine1 = new LogLine {
                LineType = LogLineType.WorkUnitFrame, LineData = new UnitFrame {
                    FrameID = 1
                }
            };
            var unitFrame5 = new UnitFrame {
                FrameID = 5
            };
            var logLine5 = new LogLine {
                LineType = LogLineType.WorkUnitFrame, LineData = unitFrame5
            };

            unitInfo.LogLines = new List <LogLine>(new[] { logLine0, logLine1, logLine5 });
            // Act & Assert
            Assert.AreSame(unitFrame5, unitInfo.CurrentFrame);
        }
Exemplo n.º 10
0
 public void ComparisonTest2()
 {
    var frame1 = new UnitFrame();
    var frame2 = new object();
    // calls Object.Equals() override
    Assert.AreNotEqual(frame1, frame2);
 }
Exemplo n.º 11
0
    void CreateUnit(Move move)
    {
        UnitFrame unit = new UnitFrame();

        unit.HexGrid  = this;
        unit.NextMove = move;

        unit.playerId        = move.PlayerId;
        unit.MoveUpdateStats = move.Stats;
        unit.UnitId          = move.UnitId;

        if (move.Stats.EngineLevel == 0)
        {
            // Cannot move to targetpos
            unit.currentPos = move.Positions[move.Positions.Count - 1];
        }
        else
        {
            // Move to targetpos
            unit.currentPos = move.Positions[0];
        }
        unit.Assemble();
        Units.Add(move.UnitId, unit);

        /*
         * Text label = Instantiate<Text>(cellLabelPrefab);
         * label.rectTransform.SetParent(gridCanvas.transform, false);
         * label.rectTransform.anchoredPosition = new Vector2(unitPos3.x, unitPos3.z);
         * label.text = "\r\n" + move.UnitId;*/
    }
Exemplo n.º 12
0
        public void ComparisonTest2()
        {
            var frame1 = new UnitFrame();
            var frame2 = new object();

            // calls Object.Equals() override
            Assert.AreNotEqual(frame1, frame2);
        }
Exemplo n.º 13
0
        public void HashCodeTest2()
        {
            var frame = new UnitFrame {
                FrameID = 89, TimeOfFrame = TimeSpan.FromHours(5), FrameDuration = TimeSpan.FromMinutes(4)
            };

            Assert.AreEqual(1742409840, frame.GetHashCode());
        }
Exemplo n.º 14
0
        public void ComparisonTest3()
        {
            var frame1 = new UnitFrame();
            var frame2 = new UnitFrame();

            Assert.IsTrue(frame1.Equals(frame2));
            Assert.IsTrue(frame1.CompareTo(frame2) == 0);
        }
Exemplo n.º 15
0
 public void ComparisonTest14()
 {
     var frame1 = new UnitFrame();
      var frame2 = new UnitFrame();
      Assert.IsTrue(frame1 == frame2);
      Assert.IsFalse(frame1 != frame2);
      Assert.IsFalse(frame1 < frame2);
      Assert.IsFalse(frame1 > frame2);
 }
Exemplo n.º 16
0
        public static void SetUnitFrame(this UnitInfo unitInfo, UnitFrame unitFrame)
        {
            var logLines = unitInfo.LogLines ?? new List <LogLine>();

            logLines.Add(new LogLine {
                LineType = LogLineType.WorkUnitFrame, LineData = unitFrame
            });
            unitInfo.LogLines = logLines;
        }
Exemplo n.º 17
0
        public void ComparisonTest17()
        {
            var frame1 = new UnitFrame();

            Assert.IsFalse(frame1 == null);
            Assert.IsTrue(frame1 != null);
            Assert.IsFalse(frame1 < null);
            Assert.IsTrue(frame1 > null);
        }
Exemplo n.º 18
0
        public void ComparisonTest18()
        {
            var frame1 = new UnitFrame();

            Assert.IsFalse(null == frame1);
            Assert.IsTrue(null != frame1);
            Assert.IsTrue(null < frame1);
            Assert.IsFalse(null > frame1);
        }
Exemplo n.º 19
0
        public void ComparisonTest14()
        {
            var frame1 = new UnitFrame();
            var frame2 = new UnitFrame();

            Assert.IsTrue(frame1 == frame2);
            Assert.IsFalse(frame1 != frame2);
            Assert.IsFalse(frame1 < frame2);
            Assert.IsFalse(frame1 > frame2);
        }
Exemplo n.º 20
0
 public void UnitInfo_CurrentFrame_Test2()
 {
    // Arrange
    var unitInfo = new UnitInfo();
    var unitFrame = new UnitFrame { FrameID = 0 };
    var logLine = new LogLine { LineType = LogLineType.WorkUnitFrame, LineData = unitFrame };
    unitInfo.LogLines = new List<LogLine>(new[] { logLine });
    // Act & Assert
    Assert.AreSame(unitFrame, unitInfo.CurrentFrame);
 }
Exemplo n.º 21
0
        public void ComparisonTest5()
        {
            var frame1 = new UnitFrame();
            var frame2 = new UnitFrame {
                FrameID = 1
            };

            Assert.IsFalse(frame1.Equals(frame2));
            Assert.IsTrue(frame1.CompareTo(frame2) < 0);
        }
Exemplo n.º 22
0
        internal virtual object GetLineData(LogLine logLine)
        {
            switch (logLine.LineType)
            {
            case LogLineType.WorkUnitProject:
                Match projectIdMatch;
                if ((projectIdMatch = ProjectIDRegex.Match(logLine.LineRaw)).Success)
                {
                    return(projectIdMatch);
                }
                return(new LogLineError(String.Format("Failed to parse Project (R/C/G) values from '{0}'", logLine.LineRaw)));

            case LogLineType.WorkUnitCoreVersion:
                Match coreVersionMatch;
                if ((coreVersionMatch = CoreVersionRegex.Match(logLine.LineRaw)).Success)
                {
                    float value;
                    if (Single.TryParse(coreVersionMatch.Result("${CoreVer}").Trim(), NumberStyles.Number, CultureInfo.InvariantCulture, out value))
                    {
                        return(value);
                    }
                    return(new LogLineError(String.Format("Failed to parse Core Version value from '{0}'", logLine.LineRaw)));
                }
                // return null here because a derived parser may also parse these lines
                // if we were to return LogLineError the line would be marked as an error
                // line and we don't want that (see LogLineParserLegacy).
                return(null);

            case LogLineType.WorkUnitFrame:
                UnitFrame frame = GetUnitFrame(logLine);
                if (frame != null)
                {
                    return(frame);
                }
                frame = GetGpuUnitFrame(logLine);
                if (frame != null)
                {
                    return(frame);
                }
                return(new LogLineError(String.Format("Failed to parse Frame Data from '{0}'", logLine.LineRaw)));

            case LogLineType.WorkUnitCoreShutdown:
                Match coreShutdownMatch;
                if ((coreShutdownMatch = CoreShutdownRegex.Match(logLine.LineRaw)).Success)
                {
                    // remove any carriage returns from fahclient log lines - 12/30/11
                    string unitResultValue = coreShutdownMatch.Result("${UnitResult}").Replace("\r", String.Empty);
                    return(unitResultValue.ToWorkUnitResult());
                }
                return(new LogLineError(String.Format("Failed to parse Work Unit Result value from '{0}'", logLine.LineRaw)));
            }

            return(null);
        }
Exemplo n.º 23
0
        public void ComparisonTest6()
        {
            var frame1 = new UnitFrame {
                FrameID = 1, TimeOfFrame = TimeSpan.FromMinutes(5), FrameDuration = TimeSpan.FromMinutes(5)
            };
            var frame2 = new UnitFrame {
                FrameID = 1, TimeOfFrame = TimeSpan.FromMinutes(5), FrameDuration = TimeSpan.FromMinutes(5)
            };

            Assert.IsTrue(frame1.Equals(frame2));
            Assert.IsTrue(frame1.CompareTo(frame2) == 0);
        }
Exemplo n.º 24
0
 public void UnitInfo_CurrentFrame_Test3()
 {
    // Arrange
    var unitInfo = new UnitInfo();
    var logLine0 = new LogLine { LineType = LogLineType.WorkUnitFrame, LineData = new UnitFrame { FrameID = 0 } };
    var logLine1 = new LogLine { LineType = LogLineType.WorkUnitFrame, LineData = new UnitFrame { FrameID = 1 } };
    var unitFrame5 = new UnitFrame { FrameID = 5 };
    var logLine5 = new LogLine { LineType = LogLineType.WorkUnitFrame, LineData = unitFrame5 };
    unitInfo.LogLines = new List<LogLine>(new[] { logLine0, logLine1, logLine5 });
    // Act & Assert
    Assert.AreSame(unitFrame5, unitInfo.CurrentFrame);
 }
Exemplo n.º 25
0
        public void ComparisonTest9()
        {
            var frame1 = new UnitFrame {
                TimeOfFrame = TimeSpan.FromMinutes(1)
            };
            var frame2 = new UnitFrame {
                TimeOfFrame = TimeSpan.FromMinutes(2)
            };

            Assert.IsFalse(frame1.Equals(frame2));
            Assert.IsTrue(frame1.CompareTo(frame2) < 0);
        }
Exemplo n.º 26
0
    public TeamFrame(List<Unit> units)
    {
        this.units = units;
        frame = new MovieClip ("Flash GUI/game_gui.swf:team_frame");

        foreach(Unit unit in units){
            UnitFrame unit_frame = new UnitFrame(unit);
            unitFrames.Add(unit_frame);
        }

        PopulateFrame();
    }
Exemplo n.º 27
0
        public void ComparisonTest12()
        {
            var frame1 = new UnitFrame {
                FrameDuration = TimeSpan.FromMinutes(2)
            };
            var frame2 = new UnitFrame {
                FrameDuration = TimeSpan.FromMinutes(1)
            };

            Assert.IsFalse(frame1.Equals(frame2));
            Assert.IsTrue(frame1.CompareTo(frame2) > 0);
        }
Exemplo n.º 28
0
    // Update is called once per frame
    void Update()
    {
        UnitFrame?.Move(this);

        if (UnitFrame?.NextMove?.MoveType == MoveType.Upgrade)
        {
            if (UnitFrame.NextMove?.MoveType == MoveType.Upgrade &&
                UnitFrame.NextMove?.Stats != null)
            {
                UnitFrame.MoveUpdateStats = UnitFrame.NextMove.Stats;
                UnitFrame.Assemble();
            }

            if (particleSource == null)
            {
                Position from       = UnitFrame.NextMove.Positions[0];
                HexCell  sourceCell = UnitFrame.HexGrid.GroundCells[from];

                particleSource = UnitFrame.HexGrid.MakeParticleSource("ExtractSource");
                particleSource.transform.SetParent(sourceCell.Cell.transform, false);
            }

            Position to         = UnitFrame.NextMove.Positions[UnitFrame.NextMove.Positions.Count - 1];
            HexCell  targetCell = UnitFrame.HexGrid.GroundCells[to];

            ParticleSystemForceField particleTarget = UnitFrame.HexGrid.MakeParticleTarget();
            particleTarget.transform.SetParent(targetCell.Cell.transform, false);

            Vector3 unitPos3 = particleTarget.transform.position;
            unitPos3.y += 0.1f;
            particleTarget.transform.position = unitPos3;

            particleSource.externalForces.SetInfluence(0, particleTarget);
            HexGrid.Destroy(particleTarget, 2.5f);

            particleSource.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
            var main = particleSource.main;
            main.duration = particleSource.main.duration * UnitFrame.HexGrid.GameSpeed;

            //particleSource.main.duration = particleSource.main.duration * UnitFrame.HexGrid.GameSpeed;
            particleSource.Play();

            ParticleSystem particleDust = UnitFrame.HexGrid.MakeParticleSource("Build");
            particleDust.transform.SetParent(targetCell.Cell.transform, false);
            particleDust.transform.position = particleTarget.transform.position;

            particleDust.Play();
            HexGrid.Destroy(particleDust, 2.5f);

            UnitFrame.NextMove = null;
        }
    }
Exemplo n.º 29
0
 // Use this for initialization
 void Start()
 {
     Calculate();
     hp = maxHP;
     if (GetComponent <PlayerCharacter>() != null)
     {
         isPlayer = true;
     }
     else
     {
         unitFrame = GetComponentInChildren <UnitFrame>();
     }
 }
Exemplo n.º 30
0
        public void UnitInfo_CurrentFrame_Test2()
        {
            // Arrange
            var unitInfo  = new UnitInfo();
            var unitFrame = new UnitFrame {
                FrameID = 0
            };
            var logLine = new LogLine {
                LineType = LogLineType.WorkUnitFrame, LineData = unitFrame
            };

            unitInfo.LogLines = new List <LogLine>(new[] { logLine });
            // Act & Assert
            Assert.AreSame(unitFrame, unitInfo.CurrentFrame);
        }
Exemplo n.º 31
0
            internal static UnitFrame ParseWorkUnitFrame(LogLine logLine)
            {
                UnitFrame frame = GetUnitFrame(logLine);

                if (frame != null)
                {
                    return(frame);
                }
                frame = GetGpuUnitFrame(logLine);
                if (frame != null)
                {
                    return(frame);
                }
                return(null);
            }
Exemplo n.º 32
0
 private void StorageList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (StorageList.SelectedIndex >= 0)
     {
         if (_unitTestPage == null)
         {
             _unitTestPage = new UnitTest();
             _unitTestPage.SetUnitToTest((ITestingUnit)StorageList.SelectedItem);
             UnitFrame.Navigate(_unitTestPage);
         }
         else
         {
             _unitTestPage.SetUnitToTest((ITestingUnit)StorageList.SelectedItem);
         }
     }
 }
Exemplo n.º 33
0
        public void UnitInfo_SetUnitFrameDataFromLogLines_Test3()
        {
            // this tests GetDelta() rollover functionality

            // Arrange
            var unitInfo   = new UnitInfo();
            var unitFrame0 = new UnitFrame
            {
                RawFramesComplete = 0,
                RawFramesTotal    = 100000,
                FrameID           = 0,
                TimeOfFrame       = new TimeSpan(23, 55, 0),
                FrameDuration     = new TimeSpan(0, 0, 0)
            };
            var logLine0 = new LogLine {
                LineType = LogLineType.WorkUnitFrame, LineData = unitFrame0
            };

            // Act
            unitInfo.LogLines = new List <LogLine>(new[] { logLine0 });
            // Assert 0 - no duration - first frame
            Assert.AreEqual(new TimeSpan(0, 0, 0), unitInfo.CurrentFrame.FrameDuration);

            var unitFrame1 = new UnitFrame
            {
                RawFramesComplete = 1000,
                RawFramesTotal    = 100000,
                FrameID           = 1,
                TimeOfFrame       = new TimeSpan(0, 5, 0),
                FrameDuration     = new TimeSpan(0, 0, 0)
            };
            var logLine1 = new LogLine {
                LineType = LogLineType.WorkUnitFrame, LineData = unitFrame1
            };

            // Act
            unitInfo.LogLines = new List <LogLine>(new[] { logLine0, logLine1 });
            // Assert 1 - now we get a frame duration
            Assert.AreEqual(new TimeSpan(0, 10, 0), unitInfo.CurrentFrame.FrameDuration);
        }
Exemplo n.º 34
0
            private static UnitFrame GetGpuUnitFrame(LogLine logLine)
            {
                Debug.Assert(logLine != null);

                Match framesCompletedGpu = FahLogRegex.Common.FramesCompletedGpuRegex.Match(logLine.LineRaw);

                if (framesCompletedGpu.Success)
                {
                    var frame = new UnitFrame();

                    frame.RawFramesComplete = Int32.Parse(framesCompletedGpu.Result("${Percent}"));
                    frame.RawFramesTotal    = 100; //Instance.CurrentProtein.Frames
                    // I get this from the project data but what's the point. 100% is 100%.

                    frame.TimeOfFrame = ParseTimeStamp(logLine);
                    frame.FrameID     = frame.RawFramesComplete;

                    return(frame);
                }

                return(null);
            }
Exemplo n.º 35
0
        public void UnitInfo_SetUnitFrameDataFromLogLines_Test1()
        {
            // Arrange
            var unitInfo  = new UnitInfo();
            var unitFrame = new UnitFrame
            {
                RawFramesComplete = 0,
                RawFramesTotal    = 100000,
                FrameID           = 0
            };
            var logLine = new LogLine {
                LineType = LogLineType.WorkUnitFrame, LineData = unitFrame
            };

            // Act
            unitInfo.LogLines = new List <LogLine>(new[] { logLine });
            // Assert
            Assert.AreEqual(0, unitInfo.RawFramesComplete);
            Assert.AreEqual(100000, unitInfo.RawFramesTotal);
            Assert.AreEqual(1, unitInfo.UnitFrames.Count);
            Assert.AreSame(unitFrame, unitInfo.CurrentFrame);
        }
Exemplo n.º 36
0
        private bool UpdateFrames(UnitInfo unit, int startingFrame, int endingFrame, ProteinBenchmark benchmark)
        {
            bool result = false;

            for (int i = startingFrame; i <= endingFrame; i++)
            {
                UnitFrame frame = unit.GetUnitFrame(i);
                if (frame != null)
                {
                    if (benchmark.SetFrameTime(frame.FrameDuration))
                    {
                        result = true;
                    }
                }
                else
                {
                    Logger.DebugFormat("({0}) FrameID '{1}' not found for Project {2}", unit.OwningSlotName, i, unit.ProjectID);
                }
            }

            return(result);
        }
Exemplo n.º 37
0
 public void ComparisonTest18()
 {
    var frame1 = new UnitFrame();
    Assert.IsFalse(null == frame1);
    Assert.IsTrue(null != frame1);
    Assert.IsTrue(null < frame1);
    Assert.IsFalse(null > frame1);
 }
Exemplo n.º 38
0
 public void ComparisonTest17()
 {
    var frame1 = new UnitFrame();
    Assert.IsFalse(frame1 == null);
    Assert.IsTrue(frame1 != null);
    Assert.IsFalse(frame1 < null);
    Assert.IsTrue(frame1 > null);
 }
Exemplo n.º 39
0
 public void ComparisonTest13()
 {
    var frame1 = new UnitFrame();
    Assert.IsFalse(frame1.Equals(null));
    Assert.IsTrue(frame1.CompareTo(null) > 0);
 }
Exemplo n.º 40
0
      public void UnitInfo_SetUnitFrameDataFromLogLines_Test2()
      {
         // Arrange
         var unitInfo = new UnitInfo();
         var unitFrame0 = new UnitFrame
         {
            RawFramesComplete = 0,
            RawFramesTotal = 100000,
            FrameID = 0
         };
         var logLine0 = new LogLine { LineType = LogLineType.WorkUnitFrame, LineData = unitFrame0 };
         // Act
         unitInfo.LogLines = new List<LogLine>(new[] { logLine0 });
         // Assert 0
         Assert.AreEqual(0, unitInfo.RawFramesComplete);
         Assert.AreEqual(100000, unitInfo.RawFramesTotal);
         Assert.AreEqual(1, unitInfo.UnitFrames.Count);
         Assert.AreSame(unitFrame0, unitInfo.CurrentFrame);
         // no duration - first frame
         Assert.AreEqual(new TimeSpan(0, 0, 0), unitInfo.CurrentFrame.FrameDuration);

         var unitFrame1 = new UnitFrame
         {
            RawFramesComplete = 1000,
            RawFramesTotal = 100000,
            FrameID = 1,
            TimeOfFrame = new TimeSpan(0, 5, 0)
         };
         var logLine1 = new LogLine { LineType = LogLineType.WorkUnitFrame, LineData = unitFrame1 };
         // Act
         unitInfo.LogLines = new List<LogLine>(new[] { logLine0, logLine1 });
         // Assert 1
         Assert.AreEqual(1000, unitInfo.RawFramesComplete);
         Assert.AreEqual(100000, unitInfo.RawFramesTotal);
         Assert.AreEqual(2, unitInfo.UnitFrames.Count);
         Assert.AreSame(unitFrame1, unitInfo.CurrentFrame);
         Assert.AreEqual(new TimeSpan(0, 5, 0), unitInfo.CurrentFrame.FrameDuration);

         var unitFrame2 = new UnitFrame
         {
            RawFramesComplete = 2000,
            RawFramesTotal = 100000,
            FrameID = 2,
            TimeOfFrame = new TimeSpan(0, 10, 0)
         };
         var logLine2 = new LogLine { LineType = LogLineType.WorkUnitFrame, LineData = unitFrame2 };
         // Act
         unitInfo.LogLines = new List<LogLine>(new[] { logLine0, logLine1, logLine2 });
         // Assert 2
         Assert.AreEqual(2000, unitInfo.RawFramesComplete);
         Assert.AreEqual(100000, unitInfo.RawFramesTotal);
         Assert.AreEqual(3, unitInfo.UnitFrames.Count);
         Assert.AreSame(unitFrame2, unitInfo.CurrentFrame);
         Assert.AreEqual(new TimeSpan(0, 5, 0), unitInfo.CurrentFrame.FrameDuration);
      }
Exemplo n.º 41
0
        public void SetCurrentFrameTest2()
        {
            var unitInfo = new UnitInfo();
             var unitFrame = new UnitFrame
             {
            RawFramesComplete = 0,
            RawFramesTotal = 100000,
            FrameID = 0,
            TimeOfFrame = new TimeSpan(0, 0, 0),
            FrameDuration = new TimeSpan(0, 0, 0)
             };
             unitInfo.SetUnitFrame(unitFrame);
             Assert.AreEqual(0, unitInfo.RawFramesComplete);
             Assert.AreEqual(100000, unitInfo.RawFramesTotal);
             Assert.AreEqual(1, unitInfo.FrameCount);
             Assert.AreSame(unitFrame, unitInfo.CurrentFrame);
             // no duration - first frame
             Assert.AreEqual(new TimeSpan(0, 0, 0), unitInfo.CurrentFrame.FrameDuration);

             unitFrame = new UnitFrame
             {
            RawFramesComplete = 1000,
            RawFramesTotal = 100000,
            FrameID = 1,
            TimeOfFrame = new TimeSpan(0, 5, 0),
            FrameDuration = new TimeSpan(0, 0, 0)
             };
             unitInfo.SetUnitFrame(unitFrame);
             Assert.AreEqual(1000, unitInfo.RawFramesComplete);
             Assert.AreEqual(100000, unitInfo.RawFramesTotal);
             Assert.AreEqual(2, unitInfo.FrameCount);
             Assert.AreSame(unitFrame, unitInfo.CurrentFrame);
             // still no duration - unitInfo.FramesObserved must be > 1
             Assert.AreEqual(new TimeSpan(0, 0, 0), unitInfo.CurrentFrame.FrameDuration);

             unitFrame = new UnitFrame
             {
            RawFramesComplete = 2000,
            RawFramesTotal = 100000,
            FrameID = 2,
            TimeOfFrame = new TimeSpan(0, 10, 0),
            FrameDuration = new TimeSpan(0, 0, 0)
             };
             // set observed count
             unitInfo.FramesObserved = 2;
             unitInfo.SetUnitFrame(unitFrame);
             Assert.AreEqual(2000, unitInfo.RawFramesComplete);
             Assert.AreEqual(100000, unitInfo.RawFramesTotal);
             Assert.AreEqual(3, unitInfo.FrameCount);
             Assert.AreSame(unitFrame, unitInfo.CurrentFrame);
             // now we get a frame duration
             Assert.AreEqual(new TimeSpan(0, 5, 0), unitInfo.CurrentFrame.FrameDuration);
        }
Exemplo n.º 42
0
 public static void SetUnitFrame(this UnitInfo unitInfo, UnitFrame unitFrame)
 {
    var logLines = unitInfo.LogLines ?? new List<LogLine>();
    logLines.Add(new LogLine { LineType = LogLineType.WorkUnitFrame, LineData = unitFrame });
    unitInfo.LogLines = logLines;
 }
Exemplo n.º 43
0
         private static UnitFrame GetGpuUnitFrame(LogLine logLine)
         {
            Debug.Assert(logLine != null);

            Match framesCompletedGpu = FahLogRegex.Common.FramesCompletedGpuRegex.Match(logLine.LineRaw);
            if (framesCompletedGpu.Success)
            {
               var frame = new UnitFrame();

               frame.RawFramesComplete = Int32.Parse(framesCompletedGpu.Result("${Percent}"));
               frame.RawFramesTotal = 100; //Instance.CurrentProtein.Frames
               // I get this from the project data but what's the point. 100% is 100%.

               frame.TimeOfFrame = ParseTimeStamp(logLine);
               frame.FrameID = frame.RawFramesComplete;

               return frame;
            }

            return null;
         }
Exemplo n.º 44
0
      public void UnitInfo_SetUnitFrameDataFromLogLines_Test3()
      {
         // this tests GetDelta() rollover functionality

         // Arrange
         var unitInfo = new UnitInfo();
         var unitFrame0 = new UnitFrame
         {
            RawFramesComplete = 0,
            RawFramesTotal = 100000,
            FrameID = 0,
            TimeOfFrame = new TimeSpan(23, 55, 0),
            FrameDuration = new TimeSpan(0, 0, 0)
         };
         var logLine0 = new LogLine { LineType = LogLineType.WorkUnitFrame, LineData = unitFrame0 };
         // Act
         unitInfo.LogLines = new List<LogLine>(new[] { logLine0 });
         // Assert 0 - no duration - first frame
         Assert.AreEqual(new TimeSpan(0, 0, 0), unitInfo.CurrentFrame.FrameDuration);

         var unitFrame1 = new UnitFrame
         {
            RawFramesComplete = 1000,
            RawFramesTotal = 100000,
            FrameID = 1,
            TimeOfFrame = new TimeSpan(0, 5, 0),
            FrameDuration = new TimeSpan(0, 0, 0)
         };
         var logLine1 = new LogLine { LineType = LogLineType.WorkUnitFrame, LineData = unitFrame1 };
         // Act
         unitInfo.LogLines = new List<LogLine>(new[] { logLine0, logLine1 });
         // Assert 1 - now we get a frame duration
         Assert.AreEqual(new TimeSpan(0, 10, 0), unitInfo.CurrentFrame.FrameDuration);
      }
Exemplo n.º 45
0
    void invoke()
    {
        if (WaitForTurn.WaitOne(10))
        {
            List <Position> newUpdatedPositions = new List <Position>();

            foreach (Position pos in MapInfo.Pheromones.Keys)
            {
                MapPheromone mapPheromone = MapInfo.Pheromones[pos];
                HexCell      hexCell      = GroundCells[pos];
                hexCell.Update(mapPheromone);

                newUpdatedPositions.Add(pos);
                updatedPositions.Remove(pos);
            }
            foreach (Position pos in updatedPositions)
            {
                HexCell hexCell = GroundCells[pos];
                hexCell.Update(null);
            }
            updatedPositions = newUpdatedPositions;

            //
            foreach (MapPlayerInfo mapPlayerInfo in MapInfo.PlayerInfo.Values)
            {
            }

            foreach (UnitFrame unitFrame in Units.Values)
            {
                //if (unitFrame.FinalDestination != null)
                {
                    unitFrame.JumpToTarget(unitFrame.FinalDestination);
                    //unitFrame.FinalDestination = null;
                }
                unitFrame.NextMove = null;
            }

            foreach (Move move in newMoves)
            {
                if (move.MoveType == MoveType.Add)
                {
                    if (Units.ContainsKey(move.UnitId))
                    {
                        // Happend in player view
                    }
                    else
                    {
                        CreateUnit(move);
                    }
                }
                else if (move.MoveType == MoveType.UpdateStats)
                {
                    if (Units.ContainsKey(move.UnitId))
                    {
                        UnitFrame unit = Units[move.UnitId];
                        unit.UpdateStats(move.Stats);
                    }
                    else
                    {
                        // Happend in player view
                    }
                }
                else if (move.MoveType == MoveType.Move ||
                         move.MoveType == MoveType.Extract ||
                         move.MoveType == MoveType.Fire)
                {
                    UnitFrame unit = Units[move.UnitId];
                    unit.NextMove = move;
                }
                else if (move.MoveType == MoveType.Hit)
                {
                    UnitFrame unit = Units[move.UnitId];
                    unit.NextMove = move;
                }
                else if (move.MoveType == MoveType.Upgrade)
                {
                    UnitFrame unit = Units[move.OtherUnitId];
                    unit.NextMove = move;
                }
                else if (move.MoveType == MoveType.UpdateGround)
                {
                    HexCell hexCell = GroundCells[move.Positions[0]];
                    hexCell.NextMove = move;
                    hexCell.UpdateGround();
                }
                else if (move.MoveType == MoveType.Delete)
                {
                    Debug.Log("Delete Unit " + move.UnitId);

                    UnitFrame unit = Units[move.UnitId];
                    unit.NextMove = null;
                    unit.Delete();
                    Units.Remove(move.UnitId);
                }
            }
            newMoves.Clear();
            WaitForDraw.Set();
        }
    }
Exemplo n.º 46
0
 public void HashCodeTest1()
 {
    var frame = new UnitFrame();
    Assert.AreEqual(0, frame.GetHashCode());
 }
Exemplo n.º 47
0
         private static UnitFrame GetUnitFrame(LogLine logLine)
         {
            Debug.Assert(logLine != null);

            Match framesCompleted = FahLogRegex.Common.FramesCompletedRegex.Match(logLine.LineRaw);
            if (framesCompleted.Success)
            {
               var frame = new UnitFrame();

               int result;
               if (Int32.TryParse(framesCompleted.Result("${Completed}"), out result))
               {
                  frame.RawFramesComplete = result;
               }
               else
               {
                  return null;
               }

               if (Int32.TryParse(framesCompleted.Result("${Total}"), out result))
               {
                  frame.RawFramesTotal = result;
               }
               else
               {
                  return null;
               }

               string percentString = framesCompleted.Result("${Percent}");

               Match mPercent1 = FahLogRegex.Common.Percent1Regex.Match(percentString);
               Match mPercent2 = FahLogRegex.Common.Percent2Regex.Match(percentString);

               int framePercent;
               if (mPercent1.Success)
               {
                  framePercent = Int32.Parse(mPercent1.Result("${Percent}"));
               }
               else if (mPercent2.Success)
               {
                  framePercent = Int32.Parse(mPercent2.Result("${Percent}"));
               }
               // Try to parse a percentage from in between the parentheses (for older single core clients like v5.02) - Issue 36
               else if (!Int32.TryParse(percentString, out framePercent))
               {
                  return null;
               }

               // Validate the steps are in tolerance with the detected frame percent - Issue 98
               double calculatedPercent = ((double)frame.RawFramesComplete / frame.RawFramesTotal) * 100;
               // ex. [00:19:40] Completed 82499 out of 250000 steps  (33%) - Would Validate
               //     [00:19:40] Completed 82750 out of 250000 steps  (33%) - Would Validate
               // 10% frame step tolerance. In the example the completed must be within 250 steps.
               if (Math.Abs(calculatedPercent - framePercent) <= 0.1)
               {
                  frame.TimeOfFrame = ParseTimeStamp(logLine);
                  frame.FrameID = framePercent;

                  return frame;
               }
               /*** ProtoMol Only */
               // Issue 191 - New ProtoMol Projects don't report frame progress on the precent boundry.
               if (Math.Abs(calculatedPercent - (framePercent + 1)) <= 0.1)
               {
                  frame.TimeOfFrame = ParseTimeStamp(logLine);
                  frame.FrameID = framePercent + 1;

                  return frame;
               }
               /*******************/

               return null;
            }

            return null;
         }
Exemplo n.º 48
0
 public void HashCodeTest2()
 {
    var frame = new UnitFrame { FrameID = 89, TimeOfFrame = TimeSpan.FromHours(5), FrameDuration = TimeSpan.FromMinutes(4) };
    Assert.AreEqual(1742409840, frame.GetHashCode());
 }
Exemplo n.º 49
0
        public void SetCurrentFrameTest1()
        {
            var unitInfo = new UnitInfo();
             var unitFrame = new UnitFrame
                         {
                            RawFramesComplete = 0,
                            RawFramesTotal = 100000,
                            FrameID = 0,
                            TimeOfFrame = new TimeSpan(0, 0, 0),
                            FrameDuration = new TimeSpan(0, 0, 0)
                         };
             unitInfo.SetUnitFrame(unitFrame);
             Assert.AreEqual(0, unitInfo.RawFramesComplete);
             Assert.AreEqual(100000, unitInfo.RawFramesTotal);
             Assert.AreEqual(1, unitInfo.FrameCount);
             Assert.AreSame(unitFrame, unitInfo.CurrentFrame);

             unitInfo.SetUnitFrame(unitFrame);
             // still only 1 frame
             Assert.AreEqual(1, unitInfo.FrameCount);
        }
Exemplo n.º 50
0
        public void SetCurrentFrameTest3()
        {
            // this tests GetDelta() rollover functionality

             var unitInfo = new UnitInfo();
             var unitFrame = new UnitFrame
             {
            RawFramesComplete = 0,
            RawFramesTotal = 100000,
            FrameID = 0,
            TimeOfFrame = new TimeSpan(23, 55, 0),
            FrameDuration = new TimeSpan(0, 0, 0)
             };
             unitInfo.SetUnitFrame(unitFrame);
             // no duration - first frame
             Assert.AreEqual(new TimeSpan(0, 0, 0), unitInfo.CurrentFrame.FrameDuration);

             unitFrame = new UnitFrame
             {
            RawFramesComplete = 1000,
            RawFramesTotal = 100000,
            FrameID = 1,
            TimeOfFrame = new TimeSpan(0, 5, 0),
            FrameDuration = new TimeSpan(0, 0, 0)
             };
             // set observed count
             unitInfo.FramesObserved = 2;
             unitInfo.SetUnitFrame(unitFrame);
             // now we get a frame duration
             Assert.AreEqual(new TimeSpan(0, 10, 0), unitInfo.CurrentFrame.FrameDuration);
        }
Exemplo n.º 51
0
 public void UnitInfo_SetUnitFrameDataFromLogLines_Test1()
 {
    // Arrange
    var unitInfo = new UnitInfo();
    var unitFrame = new UnitFrame
    {
       RawFramesComplete = 0,
       RawFramesTotal = 100000,
       FrameID = 0
    };
    var logLine = new LogLine { LineType = LogLineType.WorkUnitFrame, LineData = unitFrame };
    // Act
    unitInfo.LogLines = new List<LogLine>(new[] { logLine });
    // Assert
    Assert.AreEqual(0, unitInfo.RawFramesComplete);
    Assert.AreEqual(100000, unitInfo.RawFramesTotal);
    Assert.AreEqual(1, unitInfo.UnitFrames.Count);
    Assert.AreSame(unitFrame, unitInfo.CurrentFrame);
 }
Exemplo n.º 52
0
 public void ComparisonTest6()
 {
    var frame1 = new UnitFrame { FrameID = 1, TimeOfFrame = TimeSpan.FromMinutes(5), FrameDuration = TimeSpan.FromMinutes(5) };
    var frame2 = new UnitFrame { FrameID = 1, TimeOfFrame = TimeSpan.FromMinutes(5), FrameDuration = TimeSpan.FromMinutes(5) };
    Assert.IsTrue(frame1.Equals(frame2));
    Assert.IsTrue(frame1.CompareTo(frame2) == 0);
 }
Exemplo n.º 53
0
 public void ComparisonTest9()
 {
    var frame1 = new UnitFrame { TimeOfFrame = TimeSpan.FromMinutes(1) };
    var frame2 = new UnitFrame { TimeOfFrame = TimeSpan.FromMinutes(2) };
    Assert.IsFalse(frame1.Equals(frame2));
    Assert.IsTrue(frame1.CompareTo(frame2) < 0);
 }
Exemplo n.º 54
0
            private static UnitFrame GetUnitFrame(LogLine logLine)
            {
                Debug.Assert(logLine != null);

                Match framesCompleted = FahLogRegex.Common.FramesCompletedRegex.Match(logLine.LineRaw);

                if (framesCompleted.Success)
                {
                    var frame = new UnitFrame();

                    int result;
                    if (Int32.TryParse(framesCompleted.Result("${Completed}"), out result))
                    {
                        frame.RawFramesComplete = result;
                    }
                    else
                    {
                        return(null);
                    }

                    if (Int32.TryParse(framesCompleted.Result("${Total}"), out result))
                    {
                        frame.RawFramesTotal = result;
                    }
                    else
                    {
                        return(null);
                    }

                    string percentString = framesCompleted.Result("${Percent}");

                    Match mPercent1 = FahLogRegex.Common.Percent1Regex.Match(percentString);
                    Match mPercent2 = FahLogRegex.Common.Percent2Regex.Match(percentString);

                    int framePercent;
                    if (mPercent1.Success)
                    {
                        framePercent = Int32.Parse(mPercent1.Result("${Percent}"));
                    }
                    else if (mPercent2.Success)
                    {
                        framePercent = Int32.Parse(mPercent2.Result("${Percent}"));
                    }
                    // Try to parse a percentage from in between the parentheses (for older single core clients like v5.02) - Issue 36
                    else if (!Int32.TryParse(percentString, out framePercent))
                    {
                        return(null);
                    }

                    // Validate the steps are in tolerance with the detected frame percent - Issue 98
                    double calculatedPercent = ((double)frame.RawFramesComplete / frame.RawFramesTotal) * 100;
                    // ex. [00:19:40] Completed 82499 out of 250000 steps  (33%) - Would Validate
                    //     [00:19:40] Completed 82750 out of 250000 steps  (33%) - Would Validate
                    // 10% frame step tolerance. In the example the completed must be within 250 steps.
                    if (Math.Abs(calculatedPercent - framePercent) <= 0.1)
                    {
                        frame.TimeOfFrame = ParseTimeStamp(logLine);
                        frame.FrameID     = framePercent;

                        return(frame);
                    }
                    /*** ProtoMol Only */
                    // Issue 191 - New ProtoMol Projects don't report frame progress on the precent boundry.
                    if (Math.Abs(calculatedPercent - (framePercent + 1)) <= 0.1)
                    {
                        frame.TimeOfFrame = ParseTimeStamp(logLine);
                        frame.FrameID     = framePercent + 1;

                        return(frame);
                    }
                    /*******************/

                    return(null);
                }

                return(null);
            }
Exemplo n.º 55
0
        public void HashCodeTest1()
        {
            var frame = new UnitFrame();

            Assert.AreEqual(0, frame.GetHashCode());
        }
Exemplo n.º 56
0
    internal void Update(MapPheromone mapPheromone)
    {
        if (mapPheromone == null)
        {
            if (markerEnergy != null)
            {
                markerEnergy.transform.position = Cell.transform.position;
            }
            if (markerToHome != null)
            {
                markerToHome.transform.position = Cell.transform.position;
            }
            if (markerToMineral != null)
            {
                markerToMineral.transform.position = Cell.transform.position;
            }
            if (markerToEnemy != null)
            {
                markerToEnemy.transform.position = Cell.transform.position;
            }
        }
        else
        {
            if (markerEnergy == null)
            {
                if (markerPrefab == null)
                {
                    markerPrefab = Resources.Load <GameObject>("Prefabs/Terrain/Marker");
                }
                markerEnergy      = HexGrid.Instantiate(markerPrefab, Cell.transform, false);
                markerEnergy.name = Cell.name + "-Energy";

                markerToHome      = HexGrid.Instantiate(markerPrefab, Cell.transform, false);
                markerToHome.name = Cell.name + "-Home";
                MeshRenderer meshRenderer = markerToHome.GetComponent <MeshRenderer>();
                meshRenderer.material.color = new Color(0, 0, 0.6f);

                markerToMineral             = HexGrid.Instantiate(markerPrefab, Cell.transform, false);
                markerToMineral.name        = Cell.name + "-Mineral";
                meshRenderer                = markerToMineral.GetComponent <MeshRenderer>();
                meshRenderer.material.color = new Color(0, 0.4f, 0);

                markerToEnemy               = HexGrid.Instantiate(markerPrefab, Cell.transform, false);
                markerToEnemy.name          = Cell.name + "-Mineral";
                meshRenderer                = markerToEnemy.GetComponent <MeshRenderer>();
                meshRenderer.material.color = new Color(0.4f, 0, 0);
            }

            if (mapPheromone.IntensityToHome > 0)
            {
                Vector3 position = Cell.transform.position;
                position.y += 0.054f + (0.2f * mapPheromone.IntensityToHome);
                position.x += 0.1f;
                markerToHome.transform.position = position;
            }
            else
            {
                Vector3 position = Cell.transform.position;
                position.y -= 1;
                position.x += 0.1f;
                markerToHome.transform.position = position;
            }

            if (mapPheromone.IntensityToMineral > 0)
            {
                Vector3 position = Cell.transform.position;
                position.y += 0.054f + (0.2f * mapPheromone.IntensityToMineral);
                position.x += 0.2f;
                markerToMineral.transform.position = position;
            }
            else
            {
                Vector3 position = Cell.transform.position;
                position.y -= 1;
                position.x += 0.2f;
                markerToMineral.transform.position = position;
            }

            if (mapPheromone.IntensityToEnemy > 0)
            {
                Vector3 position = Cell.transform.position;
                position.y += 0.054f + (0.2f * mapPheromone.IntensityToEnemy);
                position.x += 0.3f;
                markerToEnemy.transform.position = position;
            }
            else
            {
                Vector3 position = Cell.transform.position;
                position.y -= 1;
                position.x += 0.3f;
                markerToEnemy.transform.position = position;
            }

            float highestEnergy   = -1;
            int   highestPlayerId = 0;

            foreach (MapPheromoneItem mapPheromoneItem in mapPheromone.PheromoneItems)
            {
                if (mapPheromoneItem.PheromoneType == Engine.Ants.PheromoneType.Energy)
                {
                    if (mapPheromoneItem.Intensity >= highestEnergy)
                    {
                        highestEnergy   = mapPheromoneItem.Intensity;
                        highestPlayerId = mapPheromoneItem.PlayerId;
                    }
                }
            }
            //highestEnergy = 0;
            if (highestEnergy > 0)
            {
                Vector3 position = Cell.transform.position;
                position.y += 0.054f + (0.2f * highestEnergy);
                markerEnergy.transform.position = position;
                UnitFrame.SetPlayerColor(highestPlayerId, markerEnergy);
            }
            else
            {
                Vector3 position = Cell.transform.position;
                position.y -= 1;
                markerEnergy.transform.position = position;
            }
        }
    }
Exemplo n.º 57
0
        private static List<UnitInfo> CreateTestList()
        {
            var list = new List<UnitInfo>();
             for (int i = 0; i < 10; i++)
             {
            var unitInfo = new UnitInfo();
            unitInfo.OwningClientName = "TestOwner";
            unitInfo.OwningClientPath = "TestPath";
            unitInfo.UnitRetrievalTime = new DateTime((2000 + i), 1, 1, 0, 0, 0);
            unitInfo.FoldingID = "TestID";
            unitInfo.Team = 32;
            unitInfo.SlotType = SlotType.CPU;
            unitInfo.DownloadTime = new DateTime(2000, 2, 2, 0, 0, 0);
            unitInfo.DueTime = new DateTime(2000, 3, 3, 0, 0, 0);
            unitInfo.UnitStartTimeStamp = TimeSpan.FromHours(i + 1);
            unitInfo.FinishedTime = new DateTime(2000, 4, 4, 0, 0, 0);
            unitInfo.CoreVersion = 2.10f;
            unitInfo.ProjectID = 2669;
            unitInfo.ProjectRun = 1;
            unitInfo.ProjectClone = 2;
            unitInfo.ProjectGen = 3;
            unitInfo.ProteinName = "Protein";
            unitInfo.ProteinTag  = "ProteinTag";
            unitInfo.UnitResult = WorkUnitResult.CoreOutdated;
            // values set by SetUnitFrame() below
            //unitInfo.RawFramesComplete = 7500;
            //unitInfo.RawFramesTotal = 250000;

            unitInfo.FramesObserved = 4;
            for (int j = 0; j < unitInfo.FramesObserved; j++)
            {
               var unitFrame = new UnitFrame { RawFramesComplete = 2500 * j, RawFramesTotal = 250000, FrameID = j, TimeOfFrame = TimeSpan.FromMinutes((j + 1) * (j + 1.5)) };
               unitInfo.SetUnitFrame(unitFrame);
            }

            list.Add(unitInfo);
             }

             for (int i = 10; i < 20; i++)
             {
            var unitInfo = new UnitInfo();
            unitInfo.OwningClientName = "TestOwner2";
            unitInfo.OwningClientPath = "TestPath2";
            unitInfo.OwningSlotId = i - 10;
            unitInfo.UnitRetrievalTime = new DateTime((2000 + i), 1, 1, 0, 0, 0);
            unitInfo.FoldingID = "TestID";
            unitInfo.Team = 32;
            unitInfo.SlotType = SlotType.CPU;
            unitInfo.DownloadTime = new DateTime(2000, 2, 2, 0, 0, 0);
            unitInfo.DueTime = new DateTime(2000, 3, 3, 0, 0, 0);
            unitInfo.UnitStartTimeStamp = TimeSpan.FromHours(i + 1);
            unitInfo.FinishedTime = new DateTime(2000, 4, 4, 0, 0, 0);
            unitInfo.CoreVersion = 2.27f;
            unitInfo.ProjectID = 6903;
            unitInfo.ProjectRun = 1;
            unitInfo.ProjectClone = 2;
            unitInfo.ProjectGen = 3;
            unitInfo.ProteinName = "Protein";
            unitInfo.ProteinTag = "ProteinTag";
            unitInfo.UnitResult = WorkUnitResult.CoreOutdated;
            // values set by SetUnitFrame() below
            //unitInfo.RawFramesComplete = 7500;
            //unitInfo.RawFramesTotal = 250000;

            unitInfo.FramesObserved = 4;
            for (int j = 0; j < unitInfo.FramesObserved; j++)
            {
               var unitFrame = new UnitFrame { RawFramesComplete = 2500 * j, RawFramesTotal = 250000, FrameID = j, TimeOfFrame = TimeSpan.FromMinutes((j + 2) * (j + 0.75)) };
               unitInfo.SetUnitFrame(unitFrame);
            }

            list.Add(unitInfo);
             }

             return list;
        }