<commit_before>﻿using System.IO;
using System.Linq;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using PoESkillTree.GameModel.Items;
using PoESkillTree.GameModel.Skills;

namespace PoESkillTree.GameModel.Tests.Skills
{
    [TestFixture]
    public class SkillJsonDeserializerTest
    {
        [Test]
        public void DeserializeReturnsCorrectResultForFrenzy()
        {
            var gemJson = JObject.Parse(File.ReadAllText(GetDataFilePath("frenzyGem.json")));
            var gemTooltipJson = JObject.Parse(File.ReadAllText(GetDataFilePath("frenzyGemTooltip.json")));

            var definitions = SkillJsonDeserializer.Deserialize(gemJson, gemTooltipJson);

            Assert.That(definitions.Skills, Has.One.Items);
            var definition = definitions.GetSkillById("Frenzy");
            Assert.AreEqual("Frenzy", definition.Id);
            Assert.AreEqual(0, definition.NumericId);
            Assert.IsFalse(definition.IsSupport);
            Assert.IsNull(definition.SupportSkill);

            var baseItem = definition.BaseItem;
            Assert.IsNotNull(baseItem);
            Assert.AreEqual("Frenzy", baseItem.DisplayName);
            Assert.AreEqual("Metadata/Items/Gems/SkillGemFrenzy", baseItem.MetadataId);
            Assert.AreEqual(ReleaseState.Released, baseItem.ReleaseState);
            Assert.AreEqual(new[] { "dexterity", "active_skill", "attack", "melee", "bow" }, baseItem.GemTags);

            var activeSkill = definition.ActiveSkill;
            Assert.AreEqual("Frenzy", activeSkill.DisplayName);
            Assert.That(activeSkill.ActiveSkillTypes, Has.Exactly(11).Items);
            Assert.IsEmpty(activeSkill.MinionActiveSkillTypes);
            Assert.AreEqual(new[] { Keyword.Attack, Keyword.Projectile, Keyword.Melee }, activeSkill.Keywords);
            Assert.IsFalse(activeSkill.ProvidesBuff);
            Assert.IsNull(activeSkill.TotemLifeMultiplier);
            Assert.IsEmpty(activeSkill.WeaponRestrictions);

            Assert.That(definition.Levels, Has.Exactly(2).Items);
            var level1 = definition.Levels[1];<commit_msg>Fix test broken by parsing update<commit_after>﻿using System.IO;
using System.Linq;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using PoESkillTree.GameModel.Items;
using PoESkillTree.GameModel.Skills;

namespace PoESkillTree.GameModel.Tests.Skills
{
    [TestFixture]
    public class SkillJsonDeserializerTest
    {
        [Test]
        public void DeserializeReturnsCorrectResultForFrenzy()
        {
            var gemJson = JObject.Parse(File.ReadAllText(GetDataFilePath("frenzyGem.json")));
            var gemTooltipJson = JObject.Parse(File.ReadAllText(GetDataFilePath("frenzyGemTooltip.json")));

            var definitions = SkillJsonDeserializer.Deserialize(gemJson, gemTooltipJson);

            Assert.That(definitions.Skills, Has.One.Items);
            var definition = definitions.GetSkillById("Frenzy");
            Assert.AreEqual("Frenzy", definition.Id);
            Assert.AreEqual(0, definition.NumericId);
            Assert.IsFalse(definition.IsSupport);
            Assert.IsNull(definition.SupportSkill);

            var baseItem = definition.BaseItem;
            Assert.IsNotNull(baseItem);
            Assert.AreEqual("Frenzy", baseItem.DisplayName);
            Assert.AreEqual("Metadata/Items/Gems/SkillGemFrenzy", baseItem.MetadataId);
            Assert.AreEqual(ReleaseState.Released, baseItem.ReleaseState);
            Assert.AreEqual(new[] { "dexterity", "active_skill", "attack", "melee", "bow" }, baseItem.GemTags);

            var activeSkill = definition.ActiveSkill;
            Assert.AreEqual("Frenzy", activeSkill.DisplayName);
            Assert.That(activeSkill.ActiveSkillTypes, Has.Exactly(11).Items);
            Assert.IsEmpty(activeSkill.MinionActiveSkillTypes);
            Assert.AreEqual(new[] { Keyword.Attack, Keyword.Projectile, Keyword.Melee, Keyword.Bow },
                activeSkill.Keywords);
            Assert.IsFalse(activeSkill.ProvidesBuff);
            Assert.IsNull(activeSkill.TotemLifeMultiplier);
            Assert.IsEmpty(activeSkill.WeaponRestrictions);

            Assert.That(definition.Levels, Has.Exactly(2).Items);
            var level1 = definition.Levels[1];
{'fraction_non_alphanumeric': 0.10842525228819526, 'fraction_numerical': 0.002816240319173903, 'mean_word_length': 3.1059730250481694, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '257069', 'n_tokens_mistral': 1246, 'n_tokens_neox': 1236, 'n_words': 167}