-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
CodeAssignStatementTests.cs
54 lines (48 loc) · 1.83 KB
/
CodeAssignStatementTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using Xunit;
namespace System.CodeDom.Tests
{
public class CodeAssignStatementTests : CodeStatementTestBase<CodeAssignStatement>
{
[Fact]
public void Ctor_Default()
{
var assign = new CodeAssignStatement();
Assert.Null(assign.Left);
Assert.Null(assign.Right);
}
public static IEnumerable<object[]> Ctor_TestData()
{
yield return new object[] { null, null };
yield return new object[] { new CodePrimitiveExpression("Value1"), null };
yield return new object[] { null, new CodePrimitiveExpression("Value2") };
yield return new object[] { new CodePrimitiveExpression("Value1"), new CodePrimitiveExpression("Value2") };
}
[Theory]
[MemberData(nameof(Ctor_TestData))]
public void Ctor_CodeExpression_CodeExpression(CodeExpression left, CodeExpression right)
{
var assign = new CodeAssignStatement(left, right);
Assert.Equal(left, assign.Left);
Assert.Equal(right, assign.Right);
}
[Theory]
[MemberData(nameof(CodeExpression_TestData))]
public void Left_Set_Get_ReturnsExpected(CodeExpression value)
{
var assign = new CodeAssignStatement();
assign.Left = value;
Assert.Equal(value, assign.Left);
}
[Theory]
[MemberData(nameof(CodeExpression_TestData))]
public void Right_Set_Get_ReturnsExpected(CodeExpression value)
{
var assign = new CodeAssignStatement();
assign.Right = value;
Assert.Equal(value, assign.Right);
}
}
}