-
Notifications
You must be signed in to change notification settings - Fork 0
/
ObjectDependenciesTraceTests.cs
57 lines (53 loc) · 2.22 KB
/
ObjectDependenciesTraceTests.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
using System;
using ObjectToTest.UnitTests.Models;
using Xunit;
using Xunit.Abstractions;
namespace ObjectToTest.UnitTests
{
public class ObjectDependenciesTraceTests
{
private readonly ITestOutputHelper _output;
public ObjectDependenciesTraceTests(ITestOutputHelper output)
{
_output = output;
}
[Fact]
public void IncorrectArgumentsClass()
{
Assert.Equal(
$"ctor IncorrectArgumentsClass{Environment.NewLine}" +
$" int first - not found in object{Environment.NewLine}" +
$" int second - not found in object{Environment.NewLine}",
new ObjectDependenciesTrace(new IncorrectArgumentsClass(1, 2))
.ToString()
.Log(_output)
);
}
[Fact(Skip = "Need to fix this test")]
public void ComplexObjectDependenciesTrace()
{
/*
* @todo #64 60m/DEV ObjectDependenciesTrace does not support recursive analyzes for invalid constructor
* arguments. The test should be fixed and recursive analyzes implemented.
*/
Assert.Equal(
$"ctor ComplexObjectWithInvalidArguments{Environment.NewLine}" +
$" IUser user - invalid{Environment.NewLine}" +
$" ctor InvalidDependencyUser user{Environment.NewLine}" +
$" IPrice price - valid{Environment.NewLine}" +
$" IRepository repository - invalid{Environment.NewLine}" +
$" ctor IncorrectArgumentsClass{Environment.NewLine}" +
$" int first - not found in object{Environment.NewLine}" +
$" int second - not found in object{Environment.NewLine}" +
$" IPrice price - valid{Environment.NewLine}",
new ObjectDependenciesTrace(
new ComplexObjectWithInvalidArguments(
new InvalidDependencyUser(new Price(20), new IncorrectArgumentsClass(1, 2)),
new Price(30)
)
).ToString()
.Log(_output)
);
}
}
}