public void GetResponse_ReturnsSuccessFalse_OnAuthError() { // Arrange dynamic json = JObject.Parse(TestJson.Get("auth-error")); var sut = new CharacterParser(); // Act Response <Character> result = sut.GetResponse <Character>(json); // Assert Assert.AreEqual(false, result.Success); Assert.AreEqual("InvalidCredentials", result.Code); Assert.AreEqual("The passed API key is invalid.", result.Status); Assert.IsNull(result.Data); }
public void GetResponse_ReturnsSuccessTrue_OnSuccess() { // Arrange dynamic json = JObject.Parse(TestJson.Get("character-success")); var sut = new CharacterParser(); // Act Response <Character> result = sut.GetResponse <Character>(json); // Assert Assert.AreEqual(true, result.Success); Assert.AreEqual("200", result.Code); Assert.AreEqual("Success.", result.Status); Assert.IsNotNull(result.Data); }
public void GetResponse_ReturnsSuccessFalse_OnApiError() { // Arrange dynamic json = JObject.Parse(TestJson.Get("api-error")); var sut = new CharacterParser(); // Act Response <Character> result = sut.GetResponse <Character>(json); // Assert Assert.AreEqual(false, result.Success); Assert.AreEqual("409", result.Code); Assert.AreEqual("Limit greater than 100.", result.Status); Assert.IsNull(result.Data); }