public void AddGroup()
        {
            var group = new AddressGroup(
                this.addressFactory.Create(),
                this.contractRegistry,
                this.permissionManager.Address);
            var registerAction = new RegisterGroupAction(string.Empty, this.addressGroupRegistry.Address, group);

            this.permissionManager.ExecuteAction(registerAction);

            Assert.True(this.addressGroupRegistry.GetAllGroups().Contains(group));
        }
        public void AddGroup_WhenAddressDuplicate_RemainsSingle()
        {
            var group = new AddressGroup(
                this.addressFactory.Create(),
                this.contractRegistry,
                this.permissionManager.Address);
            var addMemberAction = new RegisterGroupAction(string.Empty, this.addressGroupRegistry.Address, group);

            this.permissionManager.ExecuteAction(addMemberAction);
            Assert.Single(this.addressGroupRegistry.GetAllGroups());
            addMemberAction = new RegisterGroupAction(string.Empty, this.addressGroupRegistry.Address, group);
            this.permissionManager.ExecuteAction(addMemberAction);
            Assert.Single(this.addressGroupRegistry.GetAllGroups());
        }
예제 #3
0
        private bool HandleRegisterGroup(RegisterGroupAction action)
        {
            AddressGroup group = action.AddressGroup;

            try
            {
                this.registry.GetContract(group.Address);
            }
            catch (KeyNotFoundException)
            {
                this.registry.RegisterContract(group);
            }

            return(this.groupAddresses.Add(group.Address));
        }