Skip to content

Commit b96140f

Browse files
committed
fix tests by separating relationship and type names
1 parent dccaf32 commit b96140f

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

Diff for: test/UnitTests/Builders/DocumentBuilder_Tests.cs

+13-12
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public DocumentBuilder_Tests()
6060
[Fact]
6161
public void Includes_Paging_Links_By_Default()
6262
{
63-
// arrange
63+
// arrange
6464
_pageManager.PageSize = 1;
6565
_pageManager.TotalRecords = 1;
6666
_pageManager.CurrentPage = 1;
@@ -126,7 +126,8 @@ public void Related_Links_Can_Be_Disabled()
126126
public void Related_Data_Included_In_Relationships_By_Default()
127127
{
128128
// arrange
129-
const string relationshipName = "related-models";
129+
const string relatedTypeName = "related-models";
130+
const string relationshipName = "related-model";
130131
const int relatedId = 1;
131132
_jsonApiContextMock
132133
.Setup(m => m.ContextGraph)
@@ -148,9 +149,9 @@ public void Related_Data_Included_In_Relationships_By_Default()
148149
var relationshipData = document.Data.Relationships[relationshipName];
149150
Assert.NotNull(relationshipData);
150151
Assert.NotNull(relationshipData.SingleData);
151-
Assert.NotNull(relationshipData.SingleData);
152-
Assert.Equal(relatedId.ToString(), relationshipData.SingleData.Id);
153-
Assert.Equal(relationshipName, relationshipData.SingleData.Type);
152+
Assert.NotNull(relationshipData.SingleData);
153+
Assert.Equal(relatedId.ToString(), relationshipData.SingleData.Id);
154+
Assert.Equal(relatedTypeName, relationshipData.SingleData.Type);
154155
}
155156

156157
[Fact]
@@ -177,12 +178,12 @@ public void Build_Can_Build_CustomIEnumerables()
177178

178179

179180
[Theory]
180-
[InlineData(null,null,true)]
181-
[InlineData(false,null,true)]
182-
[InlineData(true,null,false)]
183-
[InlineData(null,"foo",true)]
184-
[InlineData(false,"foo",true)]
185-
[InlineData(true,"foo",true)]
181+
[InlineData(null, null, true)]
182+
[InlineData(false, null, true)]
183+
[InlineData(true, null, false)]
184+
[InlineData(null, "foo", true)]
185+
[InlineData(false, "foo", true)]
186+
[InlineData(true, "foo", true)]
186187
public void DocumentBuilderOptions(bool? omitNullValuedAttributes,
187188
string attributeValue,
188189
bool resultContainsAttribute)
@@ -194,7 +195,7 @@ public void DocumentBuilderOptions(bool? omitNullValuedAttributes,
194195
.Returns(new DocumentBuilderOptions(omitNullValuedAttributes.Value));
195196
}
196197
var documentBuilder = new DocumentBuilder(_jsonApiContextMock.Object, null, omitNullValuedAttributes.HasValue ? documentBuilderBehaviourMock.Object : null);
197-
var document = documentBuilder.Build(new Model(){StringProperty = attributeValue});
198+
var document = documentBuilder.Build(new Model() { StringProperty = attributeValue });
198199

199200
Assert.Equal(resultContainsAttribute, document.Data.Attributes.ContainsKey("StringProperty"));
200201
}

0 commit comments

Comments
 (0)