public void WhenCreatingValidNaturalUser_ItShouldReturnNaturalUserDto()
        {
            // Arrange:
            var user = new UserNaturalPostDTO(
                "*****@*****.**",
                "John",
                "Doe",
                new DateTime(1975, 12, 21, 0, 0, 0),
                CountryIso.FR,
                CountryIso.FR)
            {
                Occupation  = "programmer",
                IncomeRange = 3,
                Address     = new Address
                {
                    AddressLine1 = "Address line 1",
                    AddressLine2 = "Address line 2",
                    City         = "City",
                    Country      = CountryIso.PL,
                    PostalCode   = "11222",
                    Region       = "Region"
                },
                Capacity = CapacityType.DECLARATIVE
            };

            // Act:
            var result = _objectToTest.Create(user).Result;

            // Assert:
            Assert.NotNull(result);
            Assert.IsType <UserNaturalDTO>(result);
            Assert.True(!string.IsNullOrEmpty(result.Id));
        }
Esempio n. 2
0
        public void Create()
        {
            UserApi         userApi     = new UserApi();
            UserCreateModel createModel = this.RandomDataFiller.GetValue <UserCreateModel>();

            userApi.Create(createModel);
        }
Esempio n. 3
0
        protected override void BeginProcessing()
        {
            try
            {
                var userApi = new UserApi(Utilities.Configuration);

                var user = userApi.Create(new User()
                {
                    Properties = new UserProperties()
                    {
                        FirstName     = this.FirstName,
                        LastName      = this.LastName,
                        Password      = this.Password,
                        Email         = this.Email,
                        Administrator = this.Administrator,
                        ForceSecAuth  = this.ForceSecAuth
                    }
                });

                WriteObject(user);
            }
            catch (Exception ex)
            {
                WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null));
            }
        }
        public void Passes_the_affililate_partner_if_specified()
        {
            var fluentApi = UserApiThatReturnsUser("*****@*****.**");

            var userSignupApi = MockRepository.GenerateStub <IFluentApi <UserSignup> >();

            userSignupApi.Stub(x => x.WithParameter("", "")).IgnoreArguments().Return(userSignupApi);

            var userApi = new UserApi(fluentApi, userSignupApi);

            userApi.Create("emailAddress", "password", "boo");

            userSignupApi.AssertWasCalled(x => x.WithParameter("affiliatePartner", "boo"));
        }
        public void Doesn_not_pass_affiliate_partner_if_not_specified()
        {
            var fluentApi = UserApiThatReturnsUser("*****@*****.**");

            var userSignupApi = MockRepository.GenerateStub <IFluentApi <UserSignup> >();

            userSignupApi.Stub(x => x.WithParameter("", "")).IgnoreArguments().Return(userSignupApi);

            var userApi = new UserApi(fluentApi, userSignupApi);

            userApi.Create("emailAddress", "password");

            userSignupApi.AssertWasNotCalled(x => x.WithParameter(Arg <string> .Is.Equal("affiliatePartner"), Arg <string> .Is.Anything));
        }