< Summary

Class:GDX.Developer.Reports.Resource.Sections.ApplicationSection
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/Developer/Reports/Resource/Sections/ApplicationSection.cs
Covered lines:13
Uncovered lines:0
Coverable lines:13
Total lines:57
Line coverage:100% (13 of 13)
Covered branches:0
Total branches:0
Covered methods:3
Total methods:3
Method coverage:100% (3 of 3)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ApplicationSection(...)0%110100%
Get()0%110100%
Output(...)0%110100%

File(s)

./Packages/com.dotbunny.gdx/GDX/Developer/Reports/Resource/Sections/ApplicationSection.cs

#LineLine coverage
 1// Copyright (c) 2020-2024 dotBunny Inc.
 2// dotBunny licenses this file to you under the BSL-1.0 license.
 3// See the LICENSE file in the project root for more information.
 4
 5#if !UNITY_DOTSRUNTIME
 6
 7using System;
 8using System.Text;
 9using UnityEngine;
 10using UnityEngine.SceneManagement;
 11
 12namespace GDX.Developer.Reports.Resource.Sections
 13{
 14    /// <exception cref="UnsupportedRuntimeException">Not supported on DOTS Runtime.</exception>
 15    public readonly struct ApplicationSection
 16    {
 17        /// <summary>
 18        ///     The name of the scene that was known to the <see cref="UnityEngine.SceneManagement" /> as being the acti
 19        ///     when this <see cref="ApplicationSection" /> was created.
 20        /// </summary>
 21        public readonly string ActiveScene;
 22
 23        /// <summary>
 24        ///     The time of creation for the <see cref="ApplicationSection" />.
 25        /// </summary>
 26        public readonly DateTime Created;
 27
 28        /// <summary>
 29        ///     The platform that the <see cref="ApplicationSection" /> was created on.
 30        /// </summary>
 31        public readonly RuntimePlatform Platform;
 32
 33        public ApplicationSection(string activeScene, DateTime created, RuntimePlatform platform)
 634        {
 635            ActiveScene = activeScene;
 636            Created = created;
 637            Platform = platform;
 638        }
 39
 40        public static ApplicationSection Get()
 641        {
 642            return new ApplicationSection(
 43                SceneManager.GetActiveScene().name,
 44                DateTime.Now,
 45                Application.platform);
 646        }
 47
 48        public void Output(ResourceReportContext context, StringBuilder builder)
 449        {
 450            builder.AppendLine(ResourceReport.CreateKeyValuePair(context, "Active Scene", ActiveScene));
 451            builder.AppendLine(ResourceReport.CreateKeyValuePair(context, "Platform", Platform.ToString()));
 452            builder.AppendLine(ResourceReport.CreateKeyValuePair(context, "Created",
 53                Created.ToString(Localization.LocalTimestampFormat)));
 454        }
 55    }
 56}
 57#endif // !UNITY_DOTSRUNTIME

Coverage by test methods






Methods/Properties

ApplicationSection(System.String, System.DateTime, UnityEngine.RuntimePlatform)
Get()
Output(GDX.Developer.Reports.Resource.ResourceReportContext, System.Text.StringBuilder)