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(""));
            }
Пример #2
0
            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);
            }
Пример #3
0
            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);
            }
Пример #4
0
            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));
            }
Пример #5
0
            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);
            }
Пример #6
0
            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);
            }