Esempio n. 1
0
            public async Task EnsuresNonNullOrEmptyLogin()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new TeamsClient(connection);

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.AddMembership(1, null));

                await Assert.ThrowsAsync <ArgumentException>(() => client.AddMembership(1, ""));
            }
Esempio n. 2
0
            public async Task RequestsTheCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();

                var client = new TeamsClient(connection);

                await client.AddMembership(1, "user");

                connection.Received().Put <Dictionary <string, string> >(
                    Arg.Is <Uri>(u => u.ToString() == "teams/1/memberships/user"),
                    Args.Object);
            }
            public async Task AllowsEmptyBody()
            {
                var connection = Substitute.For <IConnection>();

                var apiConnection = new ApiConnection(connection);

                var client = new TeamsClient(apiConnection);

                await client.AddMembership(1, "user");

                connection.Received().Put <Dictionary <string, string> >(
                    Arg.Is <Uri>(u => u.ToString() == "teams/1/memberships/user"),
                    Arg.Is <object>(u => u == RequestBody.Empty));
            }
            public async Task EnsuresNonNullOrEmptyLogin()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new TeamsClient(connection);

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.AddMembership(1, null));
                await Assert.ThrowsAsync<ArgumentException>(() => client.AddMembership(1, ""));
            }
            public async Task AllowsEmptyBody()
            {
                var connection = Substitute.For<IConnection>();

                var apiConnection = new ApiConnection(connection);

                var client = new TeamsClient(apiConnection);

                await client.AddMembership(1, "user");

                connection.Received().Put<Dictionary<string, string>>(
                    Arg.Is<Uri>(u => u.ToString() == "teams/1/memberships/user"),
                    Arg.Is<object>(u => u == RequestBody.Empty));
            }
            public async Task RequestsTheCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();

                var client = new TeamsClient(connection);

                await client.AddMembership(1, "user");

                connection.Received().Put<Dictionary<string, string>>(
                    Arg.Is<Uri>(u => u.ToString() == "teams/1/memberships/user"),
                    Args.Object);
            }