public async Task EnsuresArgumentsNotNull() { var connection = Substitute.For <IApiConnection>(); var client = new EventsClient(connection); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllUserPerformed(null)); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAllUserPerformed("")); }
public void RequestsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new EventsClient(connection); client.GetAllUserPerformed("fake"); connection.Received().GetAll <Activity>(Arg.Is <Uri>(u => u.ToString() == "users/fake/events"), Args.ApiOptions); }
public void RequestsCorrectUrlWithApiOptions() { var connection = Substitute.For <IApiConnection>(); var client = new EventsClient(connection); var options = new ApiOptions { PageSize = 1, PageCount = 1, StartPage = 1 }; client.GetAllUserPerformed("fake", options); connection.Received().GetAll <Activity>(Arg.Is <Uri>(u => u.ToString() == "users/fake/events"), options); }
public async Task EnsuresNonNullArguments() { var connection = Substitute.For<IApiConnection>(); var client = new EventsClient(connection); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllUserPerformed(null)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllUserPerformed("fake", null)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllUserPerformed("")); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllUserPerformed("", ApiOptions.None)); }
public async Task RequestsCorrectUrlWithApiOptions() { var connection = Substitute.For<IApiConnection>(); var client = new EventsClient(connection); var options = new ApiOptions { PageSize = 1, PageCount = 1, StartPage = 1 }; await client.GetAllUserPerformed("fake", options); connection.Received().GetAll<Activity>(Arg.Is<Uri>(u => u.ToString() == "users/fake/events"), options); }
public async Task RequestsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new EventsClient(connection); await client.GetAllUserPerformed("fake"); connection.Received().GetAll<Activity>(Arg.Is<Uri>(u => u.ToString() == "users/fake/events"), Args.ApiOptions); }