winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

TestFullItem.cs (1871B)


      1 // -----------------------------------------------------------------------------
      2 // <copyright file="TestFullItem.cs" company="Microsoft Corporation">
      3 //     Copyright (c) Microsoft Corporation. Licensed under the MIT License.
      4 // </copyright>
      5 // -----------------------------------------------------------------------------
      6 
      7 namespace Microsoft.Management.Configuration.Processor.DSCv3.Schema_2024_04.Outputs
      8 {
      9     using Microsoft.Management.Configuration.Processor.DSCv3.Model;
     10 
     11     /// <summary>
     12     /// The full form of the test output.
     13     /// When the retrieved instance is for group resource, adapter resource, or nested inside a group or adapter resource, DSC returns a full test result, which also includes the resource type and instance name.
     14     /// </summary>
     15     internal class TestFullItem : FullItemBase<TestSimpleItem, TestFullItem>, IResourceTestItem
     16     {
     17         /// <summary>
     18         /// Initializes a new instance of the <see cref="TestFullItem"/> class.
     19         /// </summary>
     20         public TestFullItem()
     21         {
     22         }
     23 
     24         /// <inheritdoc />
     25         public bool InDesiredState
     26         {
     27             get
     28             {
     29                 if (this.SimpleResult != null)
     30                 {
     31                     return this.SimpleResult.InDesiredState;
     32                 }
     33                 else if (this.FullResults != null)
     34                 {
     35                     bool result = true;
     36 
     37                     foreach (var item in this.FullResults)
     38                     {
     39                         result = result && item.InDesiredState;
     40                     }
     41 
     42                     return result;
     43                 }
     44                 else
     45                 {
     46                     throw new System.InvalidOperationException("Test result has not been initialized.");
     47                 }
     48             }
     49         }
     50     }
     51 }