public void Test_Get_Fail() { const string expectedUri = @"https://test.com/get"; var response = new ApiResponse <TestEntity>(HttpStatusCode.NotFound, "Not Found"); var gatewayMock = new Mock <ISoundCloudApiGateway>(MockBehavior.Strict); gatewayMock.Setup(x => x.InvokeGetRequest <TestEntity>(It.Is <Uri>(y => y.ToString() == expectedUri))).Returns(response); var endpoint = new TestEndpoint(gatewayMock.Object); var result = endpoint.GetById <TestEntity>(expectedUri); Assert.That(result, Is.Null); }
public void Test_Get_Success() { const string expectedUri = @"https://test.com/get"; var testEntity = new TestEntity(); var response = new ApiResponse <TestEntity>(HttpStatusCode.OK, "OK"); response.Data = testEntity; var gatewayMock = new Mock <ISoundCloudApiGateway>(MockBehavior.Strict); gatewayMock.Setup(x => x.InvokeGetRequest <TestEntity>(It.Is <Uri>(y => y.ToString() == expectedUri))).Returns(response); var endpoint = new TestEndpoint(gatewayMock.Object); var result = endpoint.GetById <TestEntity>(expectedUri); Assert.That(result, Is.EqualTo(testEntity)); }