public void TestParseNullValueConversion() { string rawResponse = VALID_RESPONSE; ScEntityResponse response = ScReadEntitiesParser.Parse(rawResponse, 200, CancellationToken.None); Assert.AreEqual(2, response.ResultCount); ISitecoreEntity entity = response[0]; Assert.AreEqual(string.Empty, entity["Url"].RawValue); Assert.AreEqual(5, entity.FieldsCount); }
public void TestParseBoolValuesConversionToString() { string rawResponse = VALID_RESPONSE; ScEntityResponse response = ScReadEntitiesParser.Parse(rawResponse, 200, CancellationToken.None); Assert.AreEqual(2, response.ResultCount); ISitecoreEntity entity = response[0]; Assert.AreEqual("False", entity["Completed"].RawValue); Assert.AreEqual(5, entity.FieldsCount); }
public void TestParseValidResponse() { string rawResponse = VALID_RESPONSE; ScCreateEntityResponse response = ScCreateEntityParser.Parse(rawResponse, 202, CancellationToken.None); ISitecoreEntity entity = response.CreatedEntity; Assert.AreEqual("First Task", entity["Title"].RawValue); Assert.AreEqual("False", entity["Completed"].RawValue); Assert.AreEqual("4", entity["Index"].RawValue); Assert.IsTrue(response.Created); }
public void TestParseValidResponse() { string rawResponse = VALID_RESPONSE; ScEntityResponse response = ScReadEntitiesParser.Parse(rawResponse, 200, CancellationToken.None); Assert.AreEqual(2, response.ResultCount); ISitecoreEntity entity = response[0]; Assert.AreEqual("First Task", entity["Title"].RawValue); Assert.AreEqual("False", entity["Completed"].RawValue); Assert.AreEqual("4", entity["Index"].RawValue); Assert.AreEqual(5, entity.FieldsCount); }
public void TestParseFieldNamesIsCaseSensitive() { string rawResponse = VALID_RESPONSE; ScEntityResponse response = ScReadEntitiesParser.Parse(rawResponse, 200, CancellationToken.None); Assert.AreEqual(2, response.ResultCount); ISitecoreEntity entity = response[0]; Assert.AreEqual("First Task", entity["Title"].RawValue); string result; TestDelegate action = () => result = entity["title"].RawValue; Assert.Throws <KeyNotFoundException>(action); Assert.AreEqual(5, entity.FieldsCount); }
public ScCreateEntityResponse(ISitecoreEntity entity, int statusCode) { this.CreatedEntity = entity; this.StatusCode = statusCode; }