public async Task EnsuresNonNullArguments() { var client = new NotificationsClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllForCurrent((ApiOptions)null)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllForCurrent((NotificationsRequest)null)); }
public void RequestsCorrectUrl() { var endpoint = new Uri("notifications", UriKind.Relative); var connection = Substitute.For <IApiConnection>(); var client = new NotificationsClient(connection); client.GetAllForCurrent(); connection.Received().GetAll <Notification>(endpoint); }
public async Task RequestsCorrectUrl() { var endpoint = new Uri("notifications", UriKind.Relative); var connection = Substitute.For<IApiConnection>(); var client = new NotificationsClient(connection); await client.GetAllForCurrent(); connection.Received().GetAll<Notification>(endpoint, Args.ApiOptions); }
public async Task RequestsCorrectUrl() { var endpoint = new Uri("notifications", UriKind.Relative); var connection = Substitute.For <IApiConnection>(); var client = new NotificationsClient(connection); await client.GetAllForCurrent(); connection.Received().GetAll <Notification>(endpoint, Args.ApiOptions); }
public void RequestsCorrectUrl() { var endpoint = new Uri("notifications", UriKind.Relative); var connection = Substitute.For<IApiConnection>(); var client = new NotificationsClient(connection); client.GetAllForCurrent(); connection.Received().GetAll<Notification>(endpoint); }
public async Task RequestsCorrectUrlNotificationRequest() { var endpoint = new Uri("notifications", UriKind.Relative); var connection = Substitute.For<IApiConnection>(); var client = new NotificationsClient(connection); var notificationsRequest = new NotificationsRequest { All = true }; await client.GetAllForCurrent(notificationsRequest); connection.Received().GetAll<Notification>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["all"] == "true" && d["participating"] == "false"), Args.ApiOptions); }
public async Task RequestsCorrectUrlNotificationRequest() { var endpoint = new Uri("notifications", UriKind.Relative); var connection = Substitute.For <IApiConnection>(); var client = new NotificationsClient(connection); var notificationsRequest = new NotificationsRequest { All = true }; await client.GetAllForCurrent(notificationsRequest); connection.Received().GetAll <Notification>(endpoint, Arg.Is <IDictionary <string, string> >(d => d.Count == 2 && d["all"] == "true" && d["participating"] == "false"), Args.ApiOptions); }
public async Task RequestsCorrectUrlApiOptions() { var endpoint = new Uri("notifications", UriKind.Relative); var connection = Substitute.For<IApiConnection>(); var client = new NotificationsClient(connection); var options = new ApiOptions { PageCount = 1, StartPage = 1, PageSize = 1 }; await client.GetAllForCurrent(options); connection.Received().GetAll<Notification>(endpoint, options); }
public async Task RequestsCorrectUrlApiOptions() { var endpoint = new Uri("notifications", UriKind.Relative); var connection = Substitute.For <IApiConnection>(); var client = new NotificationsClient(connection); var options = new ApiOptions { PageCount = 1, StartPage = 1, PageSize = 1 }; await client.GetAllForCurrent(options); connection.Received().GetAll <Notification>(endpoint, options); }
public void RequestsCorrectUrlNotificationRequestWithApiOptions() { var endpoint = new Uri("notifications", UriKind.Relative); var connection = Substitute.For<IApiConnection>(); var client = new NotificationsClient(connection); var notificationsRequest = new NotificationsRequest { All = true }; var options = new ApiOptions { PageCount = 1, StartPage = 1, PageSize = 1 }; client.GetAllForCurrent(notificationsRequest, options); connection.Received().GetAll<Notification>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["all"] == "true" && d["participating"] == "false"), options); }
public void RequestsCorrectUrlNotificationRequestWithApiOptions() { var endpoint = new Uri("notifications", UriKind.Relative); var connection = Substitute.For <IApiConnection>(); var client = new NotificationsClient(connection); var notificationsRequest = new NotificationsRequest { All = true }; var options = new ApiOptions { PageCount = 1, StartPage = 1, PageSize = 1 }; client.GetAllForCurrent(notificationsRequest, options); connection.Received().GetAll <Notification>(endpoint, Arg.Is <IDictionary <string, string> >(d => d.Count == 2 && d["all"] == "true" && d["participating"] == "false"), options); }
public async Task EnsuresNonNullArguments() { var client = new NotificationsClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForCurrent((ApiOptions)null)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForCurrent((NotificationsRequest)null)); }