public void HudTextBoxViewModelToolCanBeSerializedDeserializedWithProtobuf() { var hudLayoutToolExpected = new HudLayoutTextBoxTool(); var hudElement = new HudElementViewModel { Seat = 1, }; var hudToolViewModelExpected = hudLayoutToolExpected.CreateViewModel(hudElement) as HudTextBoxViewModel; hudToolViewModelExpected.Width = 100; hudToolViewModelExpected.Height = 75; hudToolViewModelExpected.Position = new System.Windows.Point(5, 5); hudToolViewModelExpected.Opacity = 60; hudToolViewModelExpected.Text = "Test"; Assert.IsNotNull(hudToolViewModelExpected); var hudToolViewModelActual = SerializerHelper.GetSerializedDeserializedObject(hudToolViewModelExpected); Assert.That(hudToolViewModelActual.Id, Is.EqualTo(hudToolViewModelExpected.Id)); Assert.That(hudToolViewModelActual.ToolType, Is.EqualTo(hudToolViewModelExpected.ToolType)); 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.Opacity, Is.EqualTo(hudToolViewModelExpected.Opacity)); Assert.That(hudToolViewModelActual.Text, Is.EqualTo(hudToolViewModelExpected.Text)); }
public void HudLayoutTextBoxToolCanBeSerializedDeserializedWithProtobuf() { var hudLayoutToolExpected = new HudLayoutTextBoxTool { Text = "Test" }; var hudLayoutToolActual = SerializerHelper.GetSerializedDeserializedObject(hudLayoutToolExpected); Assert.That(hudLayoutToolActual.Id, Is.EqualTo(hudLayoutToolExpected.Id)); Assert.That(hudLayoutToolActual.Text, Is.EqualTo(hudLayoutToolExpected.Text)); Assert.That(hudLayoutToolActual.ToolType, Is.EqualTo(hudLayoutToolExpected.ToolType)); }
/// <summary> /// Creates text box view model /// </summary> /// <param name="creationInfo"><see cref="HudToolCreationInfo"/></param> /// <returns>Text box view model</returns> private HudBaseToolViewModel CreateTextBoxTool(HudToolCreationInfo creationInfo) { Check.Require(creationInfo.Layout != null, "Layout isn't defined. 4-stat box has not been created."); var layoutTool = new HudLayoutTextBoxTool { UIPositions = GetHudUIPositions(EnumTableType.HU, EnumTableType.HU, creationInfo.Position) }; layoutTool.UIPositions.ForEach(x => { x.Width = HudDefaultSettings.TextBoxWidth; x.Height = HudDefaultSettings.TextBoxHeight; }); var toolViewModel = layoutTool.CreateViewModel(creationInfo.HudElement); toolViewModel.InitializePositions(); creationInfo.Layout.LayoutTools.Add(layoutTool); return(toolViewModel); }
/// <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); }