-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02_DefaultLiterials.cs
37 lines (30 loc) · 997 Bytes
/
02_DefaultLiterials.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
using Xunit;
namespace edge
{
public class DefaultLiteralsFacts
{
[Fact]
public void should_use_default_literal_as_default_of_op()
{
// Please correct the following statement to pass the test.
const string expectedResult = "";
Assert.Equal(expectedResult, MethodWithSomeParameter(default, default));
}
[Fact]
public void default_literal_can_be_used_in_condition_test()
{
int integer = 0;
if (integer == default)
{
integer = 1;
}
// Please correct the following statement to pass the test.
const int expected = 0;
Assert.Equal(expected, integer);
}
string MethodWithSomeParameter(int integerValue, string stringValue)
{
return $"The integerValue is {integerValue} and stringValue is {stringValue ?? "(null)"}";
}
}
}