コード例 #1
0
            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));
            }
コード例 #2
0
            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);
            }
コード例 #3
0
            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);
            }
コード例 #4
0
            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);
            }
コード例 #5
0
            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);
            }
コード例 #6
0
            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);
            }
コード例 #7
0
            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);
            }
コード例 #8
0
            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);
            }
コード例 #9
0
            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);
            }
コード例 #10
0
            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);
            }
コード例 #11
0
            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);
            }
コード例 #12
0
            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));
            }