public void HudHeatMapViewModelToolCanBeSerializedDeserializedWithProtobuf() { var hudLayoutToolExpected = new HudLayoutHeatMapTool { BaseStat = new StatInfo { Stat = Stat.S3Bet } }; var hudElement = new HudElementViewModel { Seat = 1, }; var hudToolViewModelExpected = hudLayoutToolExpected.CreateViewModel(hudElement) as HudHeatMapViewModel; var heatMap = new HeatMapDto(); heatMap.OccuredByCardRange.Add("AA", 10); hudToolViewModelExpected.HeatMap = heatMap; var hudToolViewModelActual = SerializerHelper.GetSerializedDeserializedObject(hudToolViewModelExpected); Assert.That(hudToolViewModelActual.Id, Is.EqualTo(hudToolViewModelExpected.Id)); Assert.That(hudToolViewModelActual.ToolType, Is.EqualTo(hudToolViewModelExpected.ToolType)); Assert.That(hudToolViewModelActual.BaseStat.Stat, Is.EqualTo(hudToolViewModelExpected.BaseStat.Stat)); Assert.That(hudToolViewModelActual.Width, Is.EqualTo(hudToolViewModelExpected.Width)); Assert.That(hudToolViewModelActual.Height, Is.EqualTo(hudToolViewModelExpected.Height)); Assert.That(hudToolViewModelActual.Position, Is.EqualTo(hudToolViewModelExpected.Position)); Assert.That(hudToolViewModelActual.HeatMap.OccuredByCardRange.Count, Is.EqualTo(hudToolViewModelExpected.HeatMap.OccuredByCardRange.Count)); Assert.That(hudToolViewModelActual.HeatMap.OccuredByCardRange.Keys.First(), Is.EqualTo(hudToolViewModelExpected.HeatMap.OccuredByCardRange.Keys.First())); }
/// <summary> /// Creates heat map view model /// </summary> /// <param name="creationInfo"><see cref="HudToolCreationInfo"/></param> /// <returns>Graph view model</returns> private HudBaseToolViewModel CreateHeatMapTool(HudToolCreationInfo creationInfo) { Check.Require(creationInfo.Tools != null, "Layout.Tools isn't defined. Heat map has not been created."); var statInfo = creationInfo.Source as StatInfo; HudLayoutHeatMapTool layoutTool = null; if (statInfo == null) { return(null); } statInfo.IsSelected = false; layoutTool = new HudLayoutHeatMapTool { BaseStat = statInfo.Clone() }; var random = new Random(); layoutTool.BaseStat.CurrentValue = random.Next(0, 100); var toolViewModel = layoutTool.CreateViewModel(creationInfo.HudElement); toolViewModel.Position = creationInfo.Position; creationInfo.Tools.Add(layoutTool); return(toolViewModel); }
/// <summary> /// Initialize an instance of <see cref="HudHeatMapViewModel"/> /// </summary> /// <param name="tool"><see cref="HudLayoutGraphTool"/> to initialize an instance</param> private HudHeatMapViewModel(HudLayoutHeatMapTool tool) : this() { Check.ArgumentNotNull(() => tool); this.tool = tool; InitializeCommands(); }
public void HudLayoutHeatMapToolCanBeSerializedDeserializedWithProtobuf() { var hudLayoutToolExpected = new HudLayoutHeatMapTool { BaseStat = new StatInfo { Stat = Stat.S3Bet } }; var hudLayoutToolActual = SerializerHelper.GetSerializedDeserializedObject(hudLayoutToolExpected); Assert.That(hudLayoutToolActual.Id, Is.EqualTo(hudLayoutToolExpected.Id)); Assert.That(hudLayoutToolActual.BaseStat.Stat, Is.EqualTo(hudLayoutToolExpected.BaseStat.Stat)); }
/// <summary> /// Initialize an instance of <see cref="HudHeatMapViewModel"/> /// </summary> /// <param name="tool"><see cref="HudLayoutHeatMapTool"/> to initialize an instance</param> /// <param name="parent">Parent <see cref="HudElementViewModel"/> to initialize an instance</param> public HudHeatMapViewModel(HudLayoutHeatMapTool tool, HudElementViewModel parent) : this(tool) { Check.ArgumentNotNull(() => parent); Parent = parent; }
/// <summary> /// Creates <see cref="HudLayoutInfoV2"/> for tests, all tools must be included /// </summary> /// <returns><see cref="HudLayoutInfoV2"/></returns> private static HudLayoutInfoV2 CreateHudLayoutInfo() { var hudLayoutInfo = new HudLayoutInfoV2 { TableType = EnumTableType.HU, Name = "TestLayout", Filter = new HudLayoutFilter { DataFreshness = 30, TableTypes = new[] { (int)EnumTableType.HU, (int)EnumTableType.Six } }, TrackMeterPositions = new List <HudPositionsInfo> { new HudPositionsInfo { GameType = EnumGameType.MTTHoldem, PokerSite = EnumPokerSites.Bodog, HudPositions = new List <HudPositionInfo> { new HudPositionInfo { Position = new System.Windows.Point(1, 15) } } } } }; var plainBoxTool = new HudLayoutPlainBoxTool { Positions = new List <HudPositionsInfo> { new HudPositionsInfo { GameType = EnumGameType.CashHoldem, HudPositions = new List <HudPositionInfo> { new HudPositionInfo { Position = new System.Windows.Point(1, 1), Seat = 1, Width = 2 } }, PokerSite = EnumPokerSites.Bodog } }, Stats = new ReactiveList <StatInfo> { new StatInfo { Stat = Stat.VPIP } } }; var textboxTool = new HudLayoutTextBoxTool { Text = "Test" }; var fourStatBoxTool = new HudLayoutFourStatsBoxTool { Positions = new List <HudPositionsInfo> { new HudPositionsInfo { GameType = EnumGameType.CashHoldem, HudPositions = new List <HudPositionInfo> { new HudPositionInfo { Position = new System.Windows.Point(1, 1), Seat = 1, Width = 2 } }, PokerSite = EnumPokerSites.Bodog } }, Stats = new ReactiveList <StatInfo> { new StatInfo { Stat = Stat.VPIP } } }; var tiltMeterTool = new HudLayoutTiltMeterTool(); var playerIconTool = new HudLayoutPlayerIconTool(); var graphTool = new HudLayoutGraphTool(); var gaugeIndicatorTool = new HudLayoutGaugeIndicator(); var bumperStickers = new HudLayoutBumperStickersTool(); var heatMap = new HudLayoutHeatMapTool(); hudLayoutInfo.LayoutTools = new List <HudLayoutTool> { plainBoxTool, textboxTool, fourStatBoxTool, tiltMeterTool, playerIconTool, graphTool, gaugeIndicatorTool, bumperStickers, heatMap }; return(hudLayoutInfo); }