public void DecodeResponse_EnumKey() { CreateResponseDecoder <TestEnum, Greeting> decoder = new CreateResponseDecoder <TestEnum, Greeting>(); Dictionary <string, string> headers = new Dictionary <string, string>() { { "foo", "bar" }, { RestConstants.kHeaderRestliId, "SYMBOL_1" } }; HttpResponse httpResponse = new HttpResponse(RestConstants.httpStatusCreated, headers, null, null); TransportResponse transportResponse = new TransportResponse(null, httpResponse); CreateResponse <TestEnum, Greeting> response = decoder.DecodeResponse(transportResponse); Assert.AreEqual(TestEnum.Symbol.SYMBOL_1, response.key.symbol); Assert.AreEqual("SYMBOL_1", response.headers[RestConstants.kHeaderRestliId][0]); Assert.AreEqual("bar", response.headers["foo"][0]); Assert.AreEqual(RestConstants.httpStatusCreated, response.status); }
public void DecodeResponse_PrimitiveKey() { CreateResponseDecoder <int, Greeting> decoder = new CreateResponseDecoder <int, Greeting>(); Dictionary <string, string> headers = new Dictionary <string, string>() { { "foo", "bar" }, { RestConstants.kHeaderRestliId, "123" } }; HttpResponse httpResponse = new HttpResponse(RestConstants.httpStatusCreated, headers, null, null); TransportResponse transportResponse = new TransportResponse(null, httpResponse); CreateResponse <int, Greeting> response = decoder.DecodeResponse(transportResponse); Assert.AreEqual(123, response.key); Assert.AreEqual("123", response.headers[RestConstants.kHeaderRestliId][0]); Assert.AreEqual("bar", response.headers["foo"][0]); Assert.AreEqual(RestConstants.httpStatusCreated, response.status); }
public CreateRequest(TEntity input, Dictionary <string, List <string> > headers, Dictionary <string, object> queryParams, string baseUrlTemplate, Dictionary <string, object> pathKeys) : base(ResourceMethod.CREATE, input, headers, queryParams, baseUrlTemplate, pathKeys) { responseDecoder = new CreateResponseDecoder <TKey, TEntity>(); }