-
Notifications
You must be signed in to change notification settings - Fork 0
/
ObjectExtensionsTests.cs
47 lines (44 loc) · 1.75 KB
/
ObjectExtensionsTests.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
using ObjectToTest.UnitTests.Data;
using ObjectToTest.UnitTests.Models;
using Xunit;
namespace ObjectToTest.UnitTests
{
public class ObjectExtensionsTests
{
[Fact(Skip = "Need to fix this test")]
public void HasCircularReference()
{
/*
* @todo #38:60m/DEV Make HasCircularReference test to be green.
* HasCircularReference always returns false but the method should be able
* to detect the situation when object has a circular reference in its field or property.
*/
var o1 = new CircularRefPublicProperty1();
var o2 = new CircularRefPublicProperty2();
o1.PropertyName = o2;
o2.PropertyName1 = o1;
Assert.True(o1.HasCircularReference());
}
[Fact]
public void DoesNotHaveCircularReference()
{
Assert.False(new User("user name").HasCircularReference());
}
[Fact(Skip = "Need to fix this test")]
public void HasComplexCircularReference()
{
/*
* @todo #38:60m/DEV Make HasComplexCircularReference test to be green.
* HasCircularReference method should be able to detect the situation when object has a circular reference
* but not direct. Instead it uses the object that uses the other one which uses the original in its field or property.
*/
var o1 = new CircularRefPublicProperty1();
var o2 = new CircularRefPublicProperty2();
var o3 = new CircularRefPublicProperty3();
o1.PropertyName = o2;
o2.PropertyName3 = o3;
o3.PropertyName = o1;
Assert.True(o1.HasCircularReference());
}
}
}