private static void AssertEquals(ItemStat expectedItemStat, ItemStat actualItemStat) { Assert.That(actualItemStat.GetType(), Is.EqualTo(expectedItemStat.GetType())); Assert.That(actualItemStat.Id, Is.EqualTo(expectedItemStat.Id)); Assert.That(actualItemStat.StatCategory, Is.EqualTo(expectedItemStat.StatCategory)); Assert.That(actualItemStat.Text, Is.EqualTo(expectedItemStat.Text)); Assert.That(actualItemStat.TextWithPlaceholders, Is.EqualTo(expectedItemStat.TextWithPlaceholders)); if (expectedItemStat is SingleValueItemStat expectedSingleValueItemStat) { Assert.That(((SingleValueItemStat)actualItemStat).Value, Is.EqualTo(expectedSingleValueItemStat.Value)); } else if (expectedItemStat is MinMaxValueItemStat expectedMinMaxValueItemStat) { var actualMinMaxValueItemStat = (MinMaxValueItemStat)actualItemStat; Assert.That(actualMinMaxValueItemStat.MinValue, Is.EqualTo(expectedMinMaxValueItemStat.MinValue)); Assert.That(actualMinMaxValueItemStat.MaxValue, Is.EqualTo(expectedMinMaxValueItemStat.MaxValue)); } }
public void ParseShouldReturnItemStatWithoutValueIfTextDoesNotContainPlaceholders(StatCategory statCategory, string statText, string textWithPlaceholders) { string[] itemStringLines = this.itemStringBuilder .WithName("Titan Greaves") .WithItemLevel(75) .WithItemStat(statText, statCategory) .BuildLines(); this.statsDataServiceMock.Setup(x => x.GetStatData(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <string[]>())) .Returns(new StatData { Text = textWithPlaceholders }); ItemStats result = this.itemStatsParser.Parse(itemStringLines, false); Assert.That(result.AllStats, Has.Count.EqualTo(1)); ItemStat itemStat = result.AllStats.First(); Assert.That(itemStat.GetType(), Is.EqualTo(typeof(ItemStat))); }