Пример #1
0
        public void Achievements_can_be_created_from_json()
        {
            var settings = new JsonSerializerSettingsBuilder().UseTraceWriter(new XunitTraceWriter(_output))
                           .UseMissingMemberHandling(MissingMemberHandling.Error)
                           .Build();

            AssertEx.ForEach(_fixture.Db.Achievements,
                             json =>
            {
                var actual = JsonConvert.DeserializeObject <Achievement>(json, settings);

                AchievementFact.Name_is_not_empty(actual);
                AchievementFact.Description_is_not_null(actual);
                AchievementFact.Requirement_is_not_null(actual);
                AchievementFact.LockedText_is_not_null(actual);
                AchievementFact.Flags_is_not_empty(actual);
                AchievementFact.Tiers_is_not_empty(actual);
                AchievementFact.Tiers_does_not_contain_null(actual);
                AchievementFact.Rewards_does_not_contain_null(actual);
                AchievementFact.Bits_does_not_contain_null(actual);
                AchievementFact.PointCap_is_negative_1_for_repeatable_achievements_without_points(actual);
            });
        }
Пример #2
0
    public void Achievements_can_be_created_from_json() =>
    AssertEx.ForEach(
        fixture.Achievements,
        json =>
    {
        using var document = JsonDocument.Parse(json);

        var actual = document.RootElement.GetAchievement(MissingMemberBehavior.Error);

        AchievementFact.Name_is_not_empty(actual);
        AchievementFact.Description_is_not_null(actual);
        AchievementFact.Requirement_is_not_null(actual);
        AchievementFact.LockedText_is_not_null(actual);
        AchievementFact.Flags_is_not_empty(actual);
        AchievementFact.Tiers_is_not_empty(actual);
        AchievementFact.Tiers_does_not_contain_null(actual);
        AchievementFact.Rewards_does_not_contain_null(actual);
        AchievementFact.Bits_does_not_contain_null(actual);
        AchievementFact.PointCap_is_negative_1_for_repeatable_achievements_without_points(
            actual
            );
    }
        );