-
Notifications
You must be signed in to change notification settings - Fork 0
/
ObjectSharedArgumentsTests.cs
102 lines (96 loc) · 3.03 KB
/
ObjectSharedArgumentsTests.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
using System;
using ObjectToTest.Exceptions;
using ObjectToTest.UnitTests.Data;
using ObjectToTest.UnitTests.Models;
using Xunit;
namespace ObjectToTest.UnitTests
{
public class ObjectSharedArgumentsTests
{
[Fact]
/**
* @todo #12:60m/DEV Improve the test: Ideally the test should compare the result that returned by Argument method
* with some manually created argument that wraps the original object.
* Assert.Equal(
* new Argument(user),
* new ObjectSharedArguments(withUser).Argument(user)
* );
*/
public void SharedNotNullArgument()
{
var user = new User("user name");
var withUser = new WithUserArgument(
user,
new WithUserPublicProperty
{
User = user
}
);
Assert.NotNull(
new ObjectSharedArguments(withUser).Argument(user)
);
}
[Fact(Skip = "Failing need to fix")]
/**
* @todo #12:60m/DEV ObjectSharedArguments should be able to support nulls for shared objects.
*/
public void SharedNullArgument()
{
User user = null;
var withUser = new WithUserArgument(
user,
new WithUserPublicProperty
{
User = user
}
);
Assert.NotNull(
new ObjectSharedArguments(withUser).Argument(user)
);
}
[Fact]
public void NoSharedArgumentsInit()
{
var withUser = new WithUserPublicProperty
{
User = new User("user")
};
Assert.Empty(
new ObjectSharedArguments(withUser).ToString()
);
}
[Fact(Skip = "Failing need to fix")]
public void SharedArgumentsInit()
{
/**
* @todo #12:60m/DEV ObjectSharedArguments class should return as a string the piepce
* of code that initializes the shared object arguments. For example:
* var user = new User("user name");
* var withUser = new WithUserArgument(
* user,
* new WithUserPublicProperty
* {
* User = user
* }
* );
*
* ToString method should return:
* var user = new User("user name");
*
* If object has no shared objects in its internal state the method should return empty string.
*/
User user = null;
var withUser = new WithUserArgument(
user,
new WithUserPublicProperty
{
User = user
}
);
Assert.Equal(
"var user = new User(\"user name\");",
new ObjectSharedArguments(withUser).ToString()
);
}
}
}