Ejemplo n.º 1
0
        public void Test_Tracks_Delete()
        {
            const string expectedUri = @"https://api.soundcloud.com/tracks/215850263?oauth_token=myTokenId";

            var response = new ApiResponse <StatusResponse>(HttpStatusCode.OK, "OK");

            var gatewayMock = new Mock <ISoundCloudApiGateway>(MockBehavior.Strict);

            gatewayMock.Setup(x => x.InvokeDeleteRequest <StatusResponse>(It.Is <Uri>(y => y.ToString() == expectedUri))).Returns(response);

            var trackEndpoint = new Tracks(gatewayMock.Object);

            trackEndpoint.Credentials.AccessToken = Token;

            var track = new Track();

            track.id = TrackId;

            var result = trackEndpoint.Delete(track);

            Assert.That(result, Is.InstanceOf <SuccessWebResult <object> >());
            Assert.That(result.IsSuccess, Is.True);
            Assert.That(result.ErrorMessage, Is.EqualTo(string.Empty));
        }