// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Windows.Win32.Foundation;

namespace System.Private.Windows.Ole;

/// <summary>
///  Ensures the CoreClipboard is cleared before and after a test.
/// </summary>
internal ref struct ClipboardScope<TOleServices> where TOleServices : IOleServices, new()
{
    public ClipboardScope() => ClipboardCore<TOleServices>.Clear(retryTimes: 1, retryDelay: 0).Should().Be(HRESULT.S_OK);

    public readonly void Dispose() => ClipboardCore<TOleServices>.Clear(retryTimes: 1, retryDelay: 0).Should().Be(HRESULT.S_OK);
}
