winget-cli

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

InteropSetUpFixture.cs (1399B)


      1 // -----------------------------------------------------------------------------
      2 // <copyright file="InteropSetUpFixture.cs" company="Microsoft Corporation">
      3 //     Copyright (c) Microsoft Corporation. Licensed under the MIT License.
      4 // </copyright>
      5 // -----------------------------------------------------------------------------
      6 
      7 namespace AppInstallerCLIE2ETests.Interop
      8 {
      9     using System;
     10     using AppInstallerCLIE2ETests.Helpers;
     11     using NUnit.Framework;
     12 
     13     /// <summary>
     14     /// Interop set up fixture.
     15     /// </summary>
     16     [SetUpFixture]
     17     public class InteropSetUpFixture
     18     {
     19         /// <summary>
     20         /// One time set up.
     21         /// </summary>
     22         [OneTimeSetUp]
     23         public void Setup()
     24         {
     25             TestCommon.SetupTestSource();
     26         }
     27 
     28         /// <summary>
     29         /// Tear down.
     30         /// </summary>
     31         [OneTimeTearDown]
     32         public void TearDown()
     33         {
     34             try
     35             {
     36                 GC.Collect();
     37                 GC.WaitForPendingFinalizers();
     38 
     39                 TestCommon.TearDownTestSource();
     40             }
     41             catch
     42             {
     43                 // If the COM objects were not yet disposed and lock acquired
     44                 // when connecting to test source was not released, then just
     45                 // exit process since all tests have already executed.
     46             }
     47         }
     48     }
     49 }