コード例 #1
0
        public void GetResponse_ReturnsSuccessFalse_OnAuthError()
        {
            // Arrange
            dynamic json = JObject.Parse(TestJson.Get("auth-error"));

            var sut = new CreatorParser();

            // Act
            Response <Creator> result = sut.GetResponse <Creator>(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);
        }
コード例 #2
0
        public void GetResponse_ReturnsSuccessTrue_OnSuccess()
        {
            // Arrange
            dynamic json = JObject.Parse(TestJson.Get("creator-success"));

            var sut = new CreatorParser();

            // Act
            Response <Creator> result = sut.GetResponse <Creator>(json);

            // Assert
            Assert.AreEqual(true, result.Success);
            Assert.AreEqual("200", result.Code);
            Assert.AreEqual("Success.", result.Status);
            Assert.IsNotNull(result.Data);
        }
コード例 #3
0
        public void GetResponse_ReturnsSuccessFalse_OnError()
        {
            // Arrange
            dynamic json = JObject.Parse(TestJson.Get("api-error"));

            var sut = new CreatorParser();

            // Act
            Response <Creator> result = sut.GetResponse <Creator>(json);

            // Assert
            Assert.AreEqual(false, result.Success);
            Assert.AreEqual("409", result.Code);
            Assert.AreEqual("Limit greater than 100.", result.Status);
            Assert.IsNull(result.Data);
        }