public SaveMemeberStory()
        {
            base.GlobalSetup();

            _story = new Story("Save Memeber");
            _story.AsA("User")
              .IWant("to be able to save member status")
              .SoThat("I can update or create member info");

            _membershipApi = SpringContext.Current.GetObject<IMembershipApi>();
        }
 /// <summary>
 /// Construct PermissionApi instance
 /// </summary>
 /// <param name="authenticationContext"></param>
 /// <param name="membershipApi"></param>
 /// <param name="roleApi"></param>
 /// <param name="organizationApi"></param>
 /// <param name="platformConfiguration"></param>
 /// <param name="permissionConfigurationReader"></param>
 public PermissionApi(IAuthenticationContext authenticationContext, 
     IMembershipApi membershipApi,
     IRoleApi roleApi,
     IOrganizationApi organizationApi,
     IPlatformConfiguration platformConfiguration,
     IPermissionConfigurationReader permissionConfigurationReader)
     : base(authenticationContext)
 {
     this.authenticationContext = authenticationContext;
     this.membershipApi = membershipApi;
     this.roleApi = roleApi;
     this.organizationApi = organizationApi;
     this.platformConfiguration = platformConfiguration;
     this.permissionConfigurationReader = permissionConfigurationReader;
 }
        public SaveRelationShipStory()
        {
            Console.WriteLine("=================Setup===================");

               // _createdRelationshipIds = new List<Guid>();

            _createUserIds = new List<Guid>();

            base.GlobalSetup();
            _MembershipApi = SpringContext.Current.GetObject<IMembershipApi>();

            _RelationshipApi = SpringContext.Current.GetObject<IRelationshipApi>();

            Console.WriteLine("============Ending Setup===================");
        }
        public void SetupHierarchy()
        {
            IAuthenticationContext authenticationContext = SpringContext.Current.GetObject<IAuthenticationContext>();
            IOrganizationApi organizationApi = SpringContext.Current.GetObject<IOrganizationApi>();
            membershipApi = new MembershipApi(authenticationContext, organizationApi);

            this.shanghai = new HierarchyDataObject { HierarchyType = GEOGRAPHY, Name = "Shang Hai" };
            hierarchyApi.Save(this.shanghai);

            this.beijing = new HierarchyDataObject { HierarchyType = GEOGRAPHY, Name = "Bei Jing" };
            hierarchyApi.Save(this.beijing);

            this.sichuan = new HierarchyDataObject { HierarchyType = GEOGRAPHY, Name = "Si Chuan" };
            hierarchyApi.Save(this.sichuan);

            this.chengdu = new HierarchyDataObject { HierarchyType = GEOGRAPHY, Name = "Cheng Du", ParentHierarchyDataId = this.sichuan.HierarchyDataId };
            hierarchyApi.Save(this.chengdu);

            this.mianyang = new HierarchyDataObject { HierarchyType = GEOGRAPHY, Name = "Mian Yang", ParentHierarchyDataId = this.sichuan.HierarchyDataId };
            hierarchyApi.Save(this.mianyang);
        }
        public void Setup()
        {
            Console.WriteLine("=================Setup===================");

            createdObjectIds = new List<Guid>();

            base.GlobalSetup();

            _utils = new BehaveMemberShipUtils();

            _membershipApi = SpringContext.Current.GetObject<IMembershipApi>();

            Console.WriteLine("============Ending Setup===================");
        }
 public void Setup()
 {
     _story = new Story("Get the Members");
     membershipApi = SpringContext.Current.GetObject<IMembershipApi>();
 }
        private Guid CreateUser(IMembershipApi membershipApi)
        {
            IPlatformConfiguration platformConfiguration = SpringContext.Current.GetObject<IPlatformConfiguration>();

            UserObject userObject = new UserObject
            {
                OrganizationId = platformConfiguration.Organization.OrganizationId,
                Comment = "IT specialist",
                DisplayName = string.Format("DisplayName {0}", Guid.NewGuid()),
                Email = "*****@*****.**",
                IsApproved = true,
                MobilePin = "137641855XX",
                UserName = string.Format("UserName {0}", Guid.NewGuid())
            };

            membershipApi.Save(userObject, "password1", null);
            createdUserIds.Add(userObject.UserId);

            return userObject.UserId;
        }
        public void Setup()
        {
            // _createdRelationshipIds = new List<Guid>();

            _createUserIds = new List<Guid>();

            base.GlobalSetup();

            _MembershipApi = SpringContext.Current.GetObject<IMembershipApi>();
            _RelationshipApi = SpringContext.Current.GetObject<IRelationshipApi>();
        }
        private static Guid CreateUserWithExtensionProperties(IMembershipApi membershipApi)
        {
            IPlatformConfiguration platformConfiguration = SpringContext.Current.GetObject<IPlatformConfiguration>();
            UserObject userObject = new UserObject
            {
                OrganizationId = platformConfiguration.Organization.OrganizationId,
                Comment = "IT specialist",
                DisplayName = "Eunge Liu",
                Email = "*****@*****.**",
                IsApproved = true,
                MobilePin = "137641855XX",
                UserName = "******"
            };

            userObject["Birthday"] = new DateTime(1982, 2, 7);
            userObject["Sex"] = "Male";
            userObject["IdentityNo"] = "51010419820207XXXX";
            userObject["EmployeeNo"] = "200708200002";
            userObject["Department"] = "Simulation";
            userObject["Position"] = "Team Lead";
            userObject["PhoneNo"] = "021-647660XX";
            userObject["City"] = "ShangHai";
            userObject["Address"] = "MeiLong 2nd Cun, MingHang District";
            userObject["ZipCode"] = "210000";

            membershipApi.Save(userObject, "password1", null);
            return userObject.UserId;
        }