File: System\Windows\Threading\DispatcherHookEventArgsTests.cs
Web Access
Project: src\src\Microsoft.DotNet.Wpf\tests\UnitTests\WindowsBase.Tests\WindowsBase.Tests.csproj (WindowsBase.Tests)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
namespace System.Windows.Threading.Tests;
 
public class DispatcherHookEventArgsTests
{
    [Fact]
    public void Ctor_DispatcherOperation()
    {
        Dispatcher dispatcher = Dispatcher.CurrentDispatcher;
        DispatcherOperation operation = dispatcher.BeginInvoke(() => {});
 
        var args = new DispatcherHookEventArgs(operation);
        Assert.Same(dispatcher, args.Dispatcher);
        Assert.Same(operation, args.Operation);
    }
 
    [Fact]
    public void Ctor_NullOperation()
    {
        var args = new DispatcherHookEventArgs(null);
        Assert.Null(args.Dispatcher);
        Assert.Null(args.Operation);
    }
}