当前位置: 首页>>代码示例>>C#>>正文


C# UnitInfo.SetUnitFrame方法代码示例

本文整理汇总了C#中HFM.Core.DataTypes.UnitInfo.SetUnitFrame方法的典型用法代码示例。如果您正苦于以下问题:C# UnitInfo.SetUnitFrame方法的具体用法?C# UnitInfo.SetUnitFrame怎么用?C# UnitInfo.SetUnitFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HFM.Core.DataTypes.UnitInfo的用法示例。


在下文中一共展示了UnitInfo.SetUnitFrame方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CurrentFrameTest3

 public void CurrentFrameTest3()
 {
     var unitInfo = new UnitInfo();
      var unitFrame = new UnitFrame { FrameID = 0 };
      unitInfo.SetUnitFrame(unitFrame);
      unitFrame = new UnitFrame { FrameID = 1 };
      unitInfo.SetUnitFrame(unitFrame);
      unitFrame = new UnitFrame { FrameID = 5 };
      unitInfo.SetUnitFrame(unitFrame);
      Assert.AreSame(unitFrame, unitInfo.CurrentFrame);
 }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:11,代码来源:UnitInfoTests.cs

示例2: GetUnitFrameTest2

 public void GetUnitFrameTest2()
 {
     var unitInfo = new UnitInfo();
      unitInfo.SetUnitFrame(new UnitFrame { FrameID = 0 });
      Assert.IsNotNull(unitInfo.GetUnitFrame(0));
      Assert.IsNull(unitInfo.GetUnitFrame(1));
 }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:7,代码来源:UnitInfoTests.cs

示例3: CurrentFrameTest4

 public void CurrentFrameTest4()
 {
     var unitInfo = new UnitInfo();
      var unitFrame = new UnitFrame { FrameID = -1 };
      unitInfo.SetUnitFrame(unitFrame);
      Assert.IsNull(unitInfo.CurrentFrame);
 }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:7,代码来源:UnitInfoTests.cs

示例4: AllFramesCompleted1

        public void AllFramesCompleted1()
        {
            var unitInfo = new UnitInfo();
             unitInfo.SetUnitFrame(MakeUnitFrame("00:00:00", 100));
             var unitInfoLogic = CreateUnitInfoLogic(null, unitInfo);
             unitInfoLogic.UtcOffsetIsZero = false;
             unitInfoLogic.ClientTimeOffset = 0;

             Assert.IsTrue(unitInfoLogic.AllFramesCompleted);
        }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:10,代码来源:UnitInfoLogicTests.cs

示例5: PerThreeSectionsTest1

        public void PerThreeSectionsTest1()
        {
            var protein = new Protein { ProjectNumber = 1, Credit = 100 };
             var unitInfo = new UnitInfo { FramesObserved = 5 };
             unitInfo.SetUnitFrame(MakeUnitFrame("00:00:00", 0));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:05:10", 1));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:11:30", 2));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:17:40", 3));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:24:00", 4));
             var unitInfoLogic = CreateUnitInfoLogic(protein, unitInfo);
             unitInfoLogic.UtcOffsetIsZero = false;
             unitInfoLogic.ClientTimeOffset = 0;

             Assert.AreEqual(376, unitInfoLogic.GetRawTime(PpdCalculationType.LastThreeFrames));
             Assert.AreEqual(TimeSpan.FromSeconds(376), unitInfoLogic.GetFrameTime(PpdCalculationType.LastThreeFrames));
             Assert.AreEqual(229.78723, unitInfoLogic.GetPPD(SlotStatus.Unknown, PpdCalculationType.LastThreeFrames, BonusCalculationType.None));
        }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:17,代码来源:UnitInfoLogicTests.cs

示例6: PercentCompleteTest2

        public void PercentCompleteTest2()
        {
            var protein = new Protein { Frames = 200 };
             var unitInfo = new UnitInfo();
             unitInfo.SetUnitFrame(new UnitFrame { FrameID = 5 });
             var unitInfoLogic = CreateUnitInfoLogic(protein, unitInfo);
             unitInfoLogic.UtcOffsetIsZero = false;
             unitInfoLogic.ClientTimeOffset = 0;

             Assert.AreEqual(2, unitInfoLogic.PercentComplete);
        }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:11,代码来源:UnitInfoLogicTests.cs

示例7: PercentCompleteTest1

        public void PercentCompleteTest1()
        {
            var unitInfo = new UnitInfo();
             unitInfo.SetUnitFrame(new UnitFrame { FrameID = 5 });
             var unitInfoLogic = CreateUnitInfoLogic(null, unitInfo);
             unitInfoLogic.UtcOffsetIsZero = false;
             unitInfoLogic.ClientTimeOffset = 0;

             Assert.AreEqual(5, unitInfoLogic.PercentComplete);
        }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:10,代码来源:UnitInfoLogicTests.cs

示例8: SetCurrentFrameTest1

        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);
        }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:21,代码来源:UnitInfoTests.cs

示例9: BuildUnitInfo4

        private static UnitInfo BuildUnitInfo4()
        {
            var unitInfo = new UnitInfo();

             unitInfo.ProjectID = 6903;
             unitInfo.ProjectRun = 2;
             unitInfo.ProjectClone = 3;
             unitInfo.ProjectGen = 4;
             unitInfo.OwningClientName = "Owner2";
             unitInfo.OwningClientPath = "Path2";
             unitInfo.OwningSlotId = 2;
             unitInfo.FoldingID = "harlam357";
             unitInfo.Team = 32;
             unitInfo.CoreVersion = 2.27f;
             unitInfo.UnitResult = WorkUnitResult.FinishedUnit;

             // These values can be either Utc or Unspecified. Setting SQLite's DateTimeKind
             // connection string option to Utc will force SQLite to handle all DateTime
             // values as Utc regardless of the DateTimeKind specified in the value.
             unitInfo.DownloadTime = new DateTime(2012, 1, 2);
             unitInfo.FinishedTime = new DateTime(2012, 1, 5);

             // these values effect the value reported when UnitInfoLogic.GetRawTime() is called
             //unitInfo.FramesObserved =
             unitInfo.SetUnitFrame(new UnitFrame { FrameID = 99, TimeOfFrame = TimeSpan.Zero });
             unitInfo.SetUnitFrame(new UnitFrame { FrameID = 100, TimeOfFrame = TimeSpan.FromMinutes(10) });
             return unitInfo;
        }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:28,代码来源:UnitInfoDatabaseTests.cs

示例10: CreditUPDAndPPDTest1

        public void CreditUPDAndPPDTest1()
        {
            var protein = new Protein { ProjectNumber = 1, Credit = 100, KFactor = 5, PreferredDays = 3, MaximumDays = 6 };
             var utcNow = DateTime.UtcNow;
             var unitInfo = new UnitInfo { FinishedTime = utcNow, DownloadTime = utcNow.Subtract(TimeSpan.FromHours(2)), FramesObserved = 4 };
             unitInfo.SetUnitFrame(MakeUnitFrame("00:00:00", 0));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:04:00", 1));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:09:00", 2));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:15:00", 3));
             var unitInfoLogic = CreateUnitInfoLogic(protein, unitInfo);
             unitInfoLogic.UtcOffsetIsZero = false;
             unitInfoLogic.ClientTimeOffset = 0;

             Assert.AreEqual(848.528, unitInfoLogic.GetCredit(SlotStatus.RunningNoFrameTimes, PpdCalculationType.LastFrame, BonusCalculationType.DownloadTime));
             Assert.AreEqual(2.4, unitInfoLogic.GetUPD(PpdCalculationType.LastFrame));
             Assert.AreEqual(2036.4672, unitInfoLogic.GetPPD(SlotStatus.RunningNoFrameTimes, PpdCalculationType.LastFrame, BonusCalculationType.DownloadTime));
        }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:17,代码来源:UnitInfoLogicTests.cs

示例11: TimePerSectionTest3

        public void TimePerSectionTest3()
        {
            var unitInfo = new UnitInfo { FramesObserved = 5 };
             unitInfo.SetUnitFrame(MakeUnitFrame("00:00:00", 0));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:05:10", 1));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:11:30", 2));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:17:40", 3));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:24:00", 4));
             var unitInfoLogic = CreateUnitInfoLogic(null, unitInfo);
             unitInfoLogic.UtcOffsetIsZero = false;
             unitInfoLogic.ClientTimeOffset = 0;

             Assert.AreEqual(360, unitInfoLogic.GetRawTime(PpdCalculationType.AllFrames));
             Assert.AreEqual(TimeSpan.FromSeconds(360), unitInfoLogic.GetFrameTime(PpdCalculationType.AllFrames));
        }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:15,代码来源:UnitInfoLogicTests.cs

示例12: SetCurrentFrameTest4

 public void SetCurrentFrameTest4()
 {
     var unitInfo = new UnitInfo();
      unitInfo.SetUnitFrame(null);
 }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:5,代码来源:UnitInfoTests.cs

示例13: SetCurrentFrameTest3

        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);
        }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:31,代码来源:UnitInfoTests.cs

示例14: SetCurrentFrameTest2

        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);
        }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:53,代码来源:UnitInfoTests.cs

示例15: CreditUPDAndPPDTest4

        public void CreditUPDAndPPDTest4()
        {
            var unitInfo = new UnitInfo { FramesObserved = 4 };
             unitInfo.SetUnitFrame(MakeUnitFrame("00:00:00", 0));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:04:00", 1));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:09:00", 2));
             unitInfo.SetUnitFrame(MakeUnitFrame("00:15:00", 3));
             var unitInfoLogic = CreateUnitInfoLogic(null, unitInfo);
             unitInfoLogic.UtcOffsetIsZero = false;
             unitInfoLogic.ClientTimeOffset = 0;

             Assert.AreEqual(0, unitInfoLogic.GetCredit(SlotStatus.Unknown, PpdCalculationType.LastFrame, BonusCalculationType.None));
             Assert.AreEqual(2.4, unitInfoLogic.GetUPD(PpdCalculationType.LastFrame));
             Assert.AreEqual(0, unitInfoLogic.GetPPD(SlotStatus.Unknown, PpdCalculationType.LastFrame, BonusCalculationType.None));
        }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:15,代码来源:UnitInfoLogicTests.cs


注:本文中的HFM.Core.DataTypes.UnitInfo.SetUnitFrame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。