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


C# DataTypes.UnitInfo类代码示例

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


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

示例1: DuplicateTestMixed

        public void DuplicateTestMixed()
        {
            var instance1 = new SlotModel { UserId = "1" };
             var unitInfo1 = new UnitInfo { ProjectID = 1 };
             var logic1 = CreateUnitInfoLogic(unitInfo1);
             instance1.UnitInfoLogic = logic1;

             var instance2 = new SlotModel { UserId = "1" };
             var unitInfo2 = new UnitInfo { ProjectID = 2 };
             var logic2 = CreateUnitInfoLogic(unitInfo2);
             instance2.UnitInfoLogic = logic2;

             var instance3 = new SlotModel { UserId = "2" };
             var unitInfo3 = new UnitInfo { ProjectID = 1 };
             var logic3 = CreateUnitInfoLogic(unitInfo3);
             instance3.UnitInfoLogic = logic3;

             (new[] { instance1, instance2, instance3 }).FindDuplicates();

             Assert.IsTrue(instance1.UserIdIsDuplicate);
             Assert.IsTrue(instance1.ProjectIsDuplicate);
             Assert.IsTrue(instance2.UserIdIsDuplicate);
             Assert.IsFalse(instance2.ProjectIsDuplicate);
             Assert.IsFalse(instance3.UserIdIsDuplicate);
             Assert.IsTrue(instance3.ProjectIsDuplicate);
        }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:26,代码来源:ExtensionsTests.cs

示例2: 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

示例3: 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

示例4: UnitInfo_CurrentFrame_Test1

 public void UnitInfo_CurrentFrame_Test1()
 {
    // Arrange
    var unitInfo = new UnitInfo();
    // Act & Assert
    Assert.IsNull(unitInfo.CurrentFrame);
 }
开发者ID:harlam357,项目名称:hfm-net,代码行数:7,代码来源:UnitInfoTests.cs

示例5: CurrentFrameTest2

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

示例6: UnitInfo_CurrentFrame_Test2

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

示例7: 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

示例8: DownloadTimeTest3

 public void DownloadTimeTest3()
 {
    var unitInfo = new UnitInfo { DownloadTime = DateTime.UtcNow };
    var unitInfoLogic = CreateUnitInfoLogic(new Protein(), unitInfo);
    unitInfoLogic.UtcOffsetIsZero = true;
    unitInfoLogic.ClientTimeOffset = 0;
    
    Assert.AreEqual(unitInfo.DownloadTime,
                    unitInfoLogic.DownloadTime);
 }
开发者ID:harlam357,项目名称:hfm-net,代码行数:10,代码来源:UnitInfoLogicTests.cs

示例9: DownloadTimeTest4

      public void DownloadTimeTest4()
      {
         var unitInfo = new UnitInfo { DownloadTime = DateTime.UtcNow };
         var unitInfoLogic = CreateUnitInfoLogic(new Protein(), unitInfo);
         unitInfoLogic.UtcOffsetIsZero = true;
         unitInfoLogic.ClientTimeOffset = -60;

         Assert.AreEqual(unitInfo.DownloadTime
                         .Add(TimeSpan.FromMinutes(60)), 
                         unitInfoLogic.DownloadTime);
      }
开发者ID:harlam357,项目名称:hfm-net,代码行数:11,代码来源:UnitInfoLogicTests.cs

示例10: DownloadTimeTest2

 public void DownloadTimeTest2()
 {
    var unitInfo = new UnitInfo { DownloadTime = DateTime.UtcNow };
    var unitInfoLogic = CreateUnitInfoLogic(new Protein(), unitInfo);
    unitInfoLogic.UtcOffsetIsZero = false;
    unitInfoLogic.ClientTimeOffset = 60;
    
    Assert.AreEqual(unitInfo.DownloadTime.ToLocalTime()
                    .Subtract(TimeSpan.FromMinutes(60)), 
                    unitInfoLogic.DownloadTime);
 }
开发者ID:harlam357,项目名称:hfm-net,代码行数:11,代码来源:UnitInfoLogicTests.cs

示例11: UnitInfo_CurrentFrame_Test3

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

示例12: UpdateBenchmarkDataTest

      public void UpdateBenchmarkDataTest()
      {
         // setup
         var benchmarkCollection = new ProteinBenchmarkCollection();
         var database = MockRepository.GenerateMock<IUnitInfoDatabase>();
         var fahClient = new FahClient(MockRepository.GenerateStub<IMessageConnection>()) { BenchmarkCollection = benchmarkCollection, UnitInfoDatabase = database };

         var unitInfo1 = new UnitInfo();
         unitInfo1.OwningClientName = "Owner";
         unitInfo1.OwningClientPath = "Path";
         unitInfo1.OwningSlotId = 0;
         unitInfo1.ProjectID = 2669;
         unitInfo1.ProjectRun = 1;
         unitInfo1.ProjectClone = 2;
         unitInfo1.ProjectGen = 3;
         unitInfo1.FinishedTime = new DateTime(2010, 1, 1);
         unitInfo1.QueueIndex = 0;
         var currentUnitInfo = new UnitInfoModel { CurrentProtein = new Protein(), UnitInfoData = unitInfo1 };

         var unitInfo1Clone = unitInfo1.DeepClone();
         unitInfo1Clone.FramesObserved = 4;
         unitInfo1Clone.SetUnitFrame(new UnitFrame { TimeOfFrame = TimeSpan.FromMinutes(0), FrameID = 0 });
         unitInfo1Clone.SetUnitFrame(new UnitFrame { TimeOfFrame = TimeSpan.FromMinutes(5), FrameID = 1 });
         unitInfo1Clone.SetUnitFrame(new UnitFrame { TimeOfFrame = TimeSpan.FromMinutes(10), FrameID = 2 });
         unitInfo1Clone.SetUnitFrame(new UnitFrame { TimeOfFrame = TimeSpan.FromMinutes(15), FrameID = 3 });
         unitInfo1Clone.UnitResult = WorkUnitResult.FinishedUnit;
         var unitInfoLogic1 = new UnitInfoModel { CurrentProtein = new Protein(), UnitInfoData = unitInfo1Clone };

         var parsedUnits = new[] { unitInfoLogic1 };

         // arrange
         database.Stub(x => x.Connected).Return(true);
         database.Expect(x => x.Insert(null)).IgnoreArguments().Repeat.Times(1);

         var benchmarkClient = new BenchmarkClient("Owner Slot 00", "Path");

         // assert before act
         Assert.AreEqual(false, benchmarkCollection.Contains(benchmarkClient));
         Assert.AreEqual(false, new List<int>(benchmarkCollection.GetBenchmarkProjects(benchmarkClient)).Contains(2669));
         Assert.IsNull(benchmarkCollection.GetBenchmark(currentUnitInfo.UnitInfoData));

         // act
         fahClient.UpdateBenchmarkData(currentUnitInfo, parsedUnits, 0);

         // assert after act
         Assert.AreEqual(true, benchmarkCollection.Contains(benchmarkClient));
         Assert.AreEqual(true, new List<int>(benchmarkCollection.GetBenchmarkProjects(benchmarkClient)).Contains(2669));
         Assert.AreEqual(TimeSpan.FromMinutes(5), benchmarkCollection.GetBenchmark(currentUnitInfo.UnitInfoData).AverageFrameTime);

         database.VerifyAllExpectations();
      }
开发者ID:harlam357,项目名称:hfm-net,代码行数:51,代码来源:FahClientTests.cs

示例13: AggregateData

      /// <summary>
      /// Aggregate Data and return UnitInfo Dictionary.
      /// </summary>
      public DataAggregatorResult AggregateData(ClientRun clientRun, UnitCollection unitCollection, Info info, Options options,
                                                SlotOptions slotOptions, UnitInfo currentUnitInfo, int slotId)
      {
         if (clientRun == null) throw new ArgumentNullException("clientRun");
         if (unitCollection == null) throw new ArgumentNullException("unitCollection");
         if (options == null) throw new ArgumentNullException("options");
         if (slotOptions == null) throw new ArgumentNullException("slotOptions");
         if (currentUnitInfo == null) throw new ArgumentNullException("currentUnitInfo");

         var result = new DataAggregatorResult();
         result.CurrentUnitIndex = -1;

         SlotRun slotRun = null;
         if (clientRun.SlotRuns.ContainsKey(slotId))
         {
            slotRun = clientRun.SlotRuns[slotId];
         }
         result.StartTime = clientRun.Data.StartTime;
         result.Arguments = clientRun.Data.Arguments;
         result.ClientVersion = clientRun.Data.ClientVersion;
         result.UserID = clientRun.Data.UserID;
         result.MachineID = clientRun.Data.MachineID;
         result.Status = slotRun != null ? slotRun.Data.Status : SlotStatus.Unknown;

         if (Logger.IsDebugEnabled)
         {
            foreach (var s in clientRun.Where(x => x.LineType == LogLineType.Error))
            {
               Logger.DebugFormat(Constants.ClientNameFormat, ClientName, String.Format("Failed to parse log line: {0}", s));
            }
         }

         GenerateUnitInfoDataFromQueue(result, slotRun, unitCollection, options, slotOptions, currentUnitInfo, slotId);
         result.Queue = BuildClientQueue(unitCollection, info, slotOptions, slotId);

         if (result.UnitInfos.ContainsKey(result.CurrentUnitIndex) && result.UnitInfos[result.CurrentUnitIndex].LogLines != null)
         {
            result.CurrentLogLines = result.UnitInfos[result.CurrentUnitIndex].LogLines;
         }
         else if (slotRun != null)
         {
            result.CurrentLogLines = slotRun.ToList();
         }
         else
         {
            result.CurrentLogLines = clientRun.ToList();
         }

         return result;
      }
开发者ID:harlam357,项目名称:hfm-net,代码行数:53,代码来源:FahClientDataAggregator.cs

示例14: UnitInfo_DefaultPropertyValues_Test

 public void UnitInfo_DefaultPropertyValues_Test()
 {
    var unitInfo = new UnitInfo();
    Assert.AreEqual(SlotType.Unknown, unitInfo.SlotType);
    Assert.IsTrue(unitInfo.DownloadTime.IsUnknown());
    Assert.IsTrue(unitInfo.DueTime.IsUnknown());
    Assert.IsTrue(unitInfo.UnitStartTimeStamp.IsZero());
    Assert.IsTrue(unitInfo.FinishedTime.IsUnknown());
    Assert.IsTrue(unitInfo.CoreVersion == 0);
    Assert.IsTrue(unitInfo.ProteinName.Length == 0);
    Assert.IsTrue(unitInfo.ProteinTag.Length == 0);
    Assert.AreEqual(WorkUnitResult.Unknown, unitInfo.UnitResult);
    Assert.IsNull(unitInfo.LogLines);
    Assert.IsNull(unitInfo.UnitFrames);
    Assert.AreEqual(Constants.DefaultCoreID, unitInfo.CoreID);
 }
开发者ID:harlam357,项目名称:hfm-net,代码行数:16,代码来源:UnitInfoTests.cs

示例15: GenerateUnitInfoDataFromLogs

        private UnitInfo[] GenerateUnitInfoDataFromLogs()
        {
            var parsedUnits = new UnitInfo[2];
             _unitLogLines = new IList<LogLine>[2];

             if (_logInterpreterLegacy.PreviousWorkUnitLogLines != null)
             {
            _unitLogLines[0] = _logInterpreterLegacy.PreviousWorkUnitLogLines;
            parsedUnits[0] = BuildUnitInfo(null, LogReader.GetFahLogDataFromLogLines(_logInterpreterLegacy.PreviousWorkUnitLogLines), null);
             }

             bool matchOverride = false;
             _unitLogLines[1] = _logInterpreterLegacy.CurrentWorkUnitLogLines;
             if (_unitLogLines[1] == null)
             {
            matchOverride = true;
            _unitLogLines[1] = _logInterpreterLegacy.CurrentClientRunLogLines;
             }

             parsedUnits[1] = BuildUnitInfo(null, LogReader.GetFahLogDataFromLogLines(_unitLogLines[1]), GetUnitInfoLogData(), matchOverride);

             return parsedUnits;
        }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:23,代码来源:LegacyDataAggregator.cs


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