コード例 #1
0
        public void CreateAsync_NewInvitationNull_ThrowArgumentNullException()
        {
            WrikeInvitation newInvitation = null;

            var ex = Assert.ThrowsAsync <ArgumentNullException>(() => TestConstants.WrikeClient.Invitations
                                                                .CreateAsync(newInvitation));

            Assert.AreEqual("newInvitation", ex.ParamName);
        }
コード例 #2
0
        public static async Task Run(WrikeClient client)
        {
            var existingInvitations = await client.Invitations.GetAsync();

            var newInvitation = new WrikeInvitation(email: "*****@*****.**"
                                                    , firstName: "Sinann", lastName: "Tavilogluu", role: WrikeUserRole.Collaborator);

            newInvitation = await client.Invitations.CreateAsync(newInvitation, "Invitation Subject", "Invitation Message");

            existingInvitations = await client.Invitations.GetAsync();

            var updatedInvitation = await client.Invitations.UpdateAsync(newInvitation.Id, resend : true);

            await client.Invitations.DeleteAsync(updatedInvitation.Id);
        }
コード例 #3
0
        async Task <WrikeInvitation> IWrikeInvitationsClient.CreateAsync(WrikeInvitation newInvitation, string subject, string message)
        {
            if (newInvitation == null)
            {
                throw new ArgumentNullException(nameof(newInvitation));
            }

            var contenBuilder = new WrikeFormUrlEncodedContentBuilder()
                                .AddParameter("email", newInvitation.Email)
                                .AddParameter("firstName", newInvitation.FirstName)
                                .AddParameter("lastName", newInvitation.LastName)
                                .AddParameter("role", newInvitation.Role)
                                .AddParameter("external", newInvitation.External)
                                .AddParameter("subject", subject)
                                .AddParameter("message", message);

            var response = await SendRequest <WrikeInvitation>("invitations", HttpMethods.Post, contenBuilder.GetContent()).ConfigureAwait(false);

            return(GetReponseDataFirstItem(response));
        }