1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 using Xunit;
6 
7 namespace System.ComponentModel.EventBasedAsync.Tests
8 {
9     public static class DoWorkEventArgsTests
10     {
11         [Theory]
12         [InlineData(null)]
13         [InlineData("non null test argument")]
CtorTest(object expectedArgument)14         public static void CtorTest(object expectedArgument)
15         {
16             var target = new DoWorkEventArgs(expectedArgument);
17             Assert.Equal(expectedArgument, target.Argument);
18             Assert.False(target.Cancel);
19             Assert.Null(target.Result);
20         }
21 
22         [Theory]
23         [InlineData(true)]
24         [InlineData(false)]
CancelPropertyTest(bool expectedCancel)25         public static void CancelPropertyTest(bool expectedCancel)
26         {
27             var target = new DoWorkEventArgs(null) { Cancel = expectedCancel };
28             Assert.Equal(expectedCancel, target.Cancel);
29         }
30 
31         [Theory]
32         [InlineData(null)]
33         [InlineData("non null test result")]
ResultPropertyTest(object expectedResult)34         public static void ResultPropertyTest(object expectedResult)
35         {
36             var target = new DoWorkEventArgs(null) { Result = expectedResult };
37             Assert.Equal(expectedResult, target.Result);
38         }
39     }
40 }
41