@@ -70,7 +70,7 @@ public async Task Request_With_ClientGeneratedId_Returns_403()
70
70
}
71
71
72
72
[ Fact ]
73
- public async Task PostRequest_ShouldReceiveLocationHeader_InResponse ( )
73
+ public async Task ShouldReceiveLocationHeader_InResponse ( )
74
74
{
75
75
// arrange
76
76
var builder = new WebHostBuilder ( )
@@ -105,5 +105,39 @@ public async Task PostRequest_ShouldReceiveLocationHeader_InResponse()
105
105
Assert . Equal ( HttpStatusCode . Created , response . StatusCode ) ;
106
106
Assert . Equal ( $ "/api/v1/todo-items/{ deserializedBody . Id } ", response . Headers . Location . ToString ( ) ) ;
107
107
}
108
+
109
+ [ Fact ]
110
+ public async Task Respond_409_ToIncorrectEntityType ( )
111
+ {
112
+ // arrange
113
+ var builder = new WebHostBuilder ( )
114
+ . UseStartup < Startup > ( ) ;
115
+ var httpMethod = new HttpMethod ( "POST" ) ;
116
+ var route = "/api/v1/todo-items" ;
117
+ var server = new TestServer ( builder ) ;
118
+ var client = server . CreateClient ( ) ;
119
+ var request = new HttpRequestMessage ( httpMethod , route ) ;
120
+ var todoItem = _todoItemFaker . Generate ( ) ;
121
+ var content = new
122
+ {
123
+ data = new
124
+ {
125
+ type = "people" ,
126
+ attributes = new
127
+ {
128
+ description = todoItem . Description ,
129
+ ordinal = todoItem . Ordinal
130
+ }
131
+ }
132
+ } ;
133
+ request . Content = new StringContent ( JsonConvert . SerializeObject ( content ) ) ;
134
+ request . Content . Headers . ContentType = new MediaTypeHeaderValue ( "application/vnd.api+json" ) ;
135
+
136
+ // act
137
+ var response = await client . SendAsync ( request ) ;
138
+
139
+ // assert
140
+ Assert . Equal ( HttpStatusCode . Conflict , response . StatusCode ) ;
141
+ }
108
142
}
109
143
}
0 commit comments