Exemplo n.º 1
0
        /// <summary>
        /// New Friend
        /// </summary>
        /// <param name="email"></param>
        public void GotAFriend(FriendEmail email)
        {
            var activity = new Activity()
            {
                Type                = Reference.User,
                Text                = string.Format("became friends with {0}.", email.FriendDisplayName),
                UserIdentifier      = email.UserIdentifier,
                ReferenceIdentifier = email.FriendIdentifier,
            };

            this.Save(activity);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Friend Signed Up
        /// </summary>
        /// <param name="friend">Friend</param>
        public void NewFriend(FriendEmail friend)
        {
            var template = new NewFriendAdded()
            {
                Friend = friend,
            };

            try
            {
                var subject = string.Format("Your friend {0} is on Borentra.", template.Friend.FriendDisplayName);
                this.SendGeneric(template.Friend.UserEmail, fromName, subject, "Your friend is on Borentra", template.TransformText());
            }
            catch
            {
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Friend Signed Up
        /// </summary>
        /// <param name="friend">Friend</param>
        public void FriendSignedUp(FriendEmail friend)
        {
            var template = new FriendSignedUpTemplate()
            {
                Friend = friend,
            };

            try
            {
                var subject = string.Format("Your friend {0} has joined Borentra.", template.Friend.FriendDisplayName);
                this.SendGeneric(template.Friend.UserEmail, fromName, subject, "Your friend has joined Borentra", template.TransformText());
            }
            catch
            {
            }
        }
 public void Initialize()
 {
     _friendEmail = new FriendEmail {
         Email = "*****@*****.**"
     };
     _unitConfigs = new UnitConfig
     {
         FirstName = "Thomas",
         Address   = new Address(),
         Emails    = new List <FriendEmail>
         {
             new FriendEmail {
                 Email = "*****@*****.**"
             },
             _friendEmail,
         }
     };
 }
Exemplo n.º 5
0
        public void ShouldReturnValidationErrorIfEmailAddressIsNotValid()
        {
            var email   = new FriendEmail();
            var wrapper = new FriendEmailWrapper(email);

            Assert.True(wrapper.HasErrors);

            wrapper.Email = "a";
            Assert.True(wrapper.HasErrors);

            var errors = wrapper.GetErrors(nameof(wrapper.Email)).Cast <string>().ToList();

            Assert.Equal(1, errors.Count);
            Assert.Equal("Email is not a valid email address", errors.First());

            wrapper.Email = "*****@*****.**";
            Assert.False(wrapper.HasErrors);
        }
Exemplo n.º 6
0
 public void Initialaze()
 {
     _friendEmail = new FriendEmail {
         Email = "*****@*****.**"
     };
     _friend = new Friend
     {
         FirstName = "Sergej",
         Address   = new Address(),
         Emails    = new List <FriendEmail>
         {
             new FriendEmail {
                 Email = "*****@*****.**"
             },
             _friendEmail
         }
     };
 }
Exemplo n.º 7
0
 public void Initialize()
 {
     _friendEmail = new FriendEmail {
         Email = "*****@*****.**"
     };
     _friend = new Friend
     {
         FirstName = "Levon",
         Address   = new Address(),
         Emails    = new List <FriendEmail>()
         {
             new FriendEmail {
                 Email = "*****@*****.**"
             },
             _friendEmail
         }
     };
 }
 public ChangeNotificationCollectionProperty()
 {
     _friendEmail = new FriendEmail {
         Email = "*****@*****.**"
     };
     _friend = new Friend
     {
         FirstName = "Thomas",
         Address   = new Address(),
         Emails    = new List <FriendEmail>
         {
             new FriendEmail {
                 Email = "*****@*****.**"
             },
             _friendEmail
         }
     };
 }
 public void Initialize()
 {
     _friendEmail = new FriendEmail()
     {
         Email = "*****@*****.**"
     };
     _friend = new Friend
     {
         FirstName = "Babar",
         Address   = new Address(),
         Emails    = new List <FriendEmail>()
         {
             new FriendEmail()
             {
                 Email = "*****@*****.**"
             },
             _friendEmail
         }
     };
 }
 public void Initialize()
 {
     _friendEmail = new FriendEmail()
     {
         Email = "*****@*****.**"
     };
     _friend = new Friend()
     {
         FirstName = "Thomas",
         Address   = new Address(),
         Emails    = new List <FriendEmail>()
         {
             new FriendEmail()
             {
                 Email = "*****@*****.**"
             },
             _friendEmail
         }
     };
 }
Exemplo n.º 11
0
        /// <summary>
        /// Share a store to another user
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="storeId">Your store identifier</param>
        /// <param name="email">Your friend&#39;s email</param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <ApiResponse <Object> > ShareAsyncWithHttpInfo(string storeId, FriendEmail email)
        {
            // verify the required parameter 'storeId' is set
            if (storeId == null)
            {
                throw new ApiException(400, "Missing required parameter 'storeId' when calling CustomerSharesApi->Share");
            }
            // verify the required parameter 'email' is set
            if (email == null)
            {
                throw new ApiException(400, "Missing required parameter 'email' when calling CustomerSharesApi->Share");
            }

            var    localVarPath         = "/user/customer/stores/{storeId}/shares";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            localVarPathParams.Add("format", "json");
            if (storeId != null)
            {
                localVarPathParams.Add("storeId", Configuration.ApiClient.ParameterToString(storeId));                  // path parameter
            }
            if (email != null && email.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(email); // http body (model) parameter
            }
            else
            {
                localVarPostBody = email; // byte array
            }

            // authentication (api_key) required
            if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("Ocp-Apim-Subscription-Key")))
            {
                localVarHeaderParams["Ocp-Apim-Subscription-Key"] = Configuration.GetApiKeyWithPrefix("Ocp-Apim-Subscription-Key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                       Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                       localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("Share", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }


            return(new ApiResponse <Object>(localVarStatusCode,
                                            localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                            null));
        }
Exemplo n.º 12
0
 /// <summary>
 /// Share a store to another user
 /// </summary>
 /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="storeId">Your store identifier</param>
 /// <param name="email">Your friend&#39;s email</param>
 /// <returns>Task of void</returns>
 public async System.Threading.Tasks.Task ShareAsync(string storeId, FriendEmail email)
 {
     await ShareAsyncWithHttpInfo(storeId, email);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Share a store to another user
 /// </summary>
 /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="storeId">Your store identifier</param>
 /// <param name="email">Your friend&#39;s email</param>
 /// <returns></returns>
 public void Share(string storeId, FriendEmail email)
 {
     ShareWithHttpInfo(storeId, email);
 }