public void AddMember() { var member = new Member(this.addressFactory.Create(), this.contractRegistry, this.permissionManager.Address); var addMemberAction = new RegisterMemberAction(string.Empty, this.membersRegistry.Address, member); this.permissionManager.ExecuteAction(addMemberAction); var mem = this.membersRegistry.GetMember(member.Address); Assert.Equal(member, mem); }
public void AddMember_WhenAddresDuplicate_RemainsSingle() { var member = new Member(this.addressFactory.Create(), this.contractRegistry, this.permissionManager.Address); var addMemberAction = new RegisterMemberAction(string.Empty, this.membersRegistry.Address, member); this.permissionManager.ExecuteAction(addMemberAction); addMemberAction = new RegisterMemberAction(string.Empty, this.membersRegistry.Address, member); Assert.Single(this.membersRegistry.GetAllMembers()); this.permissionManager.ExecuteAction(addMemberAction); Assert.Single(this.membersRegistry.GetAllMembers()); }
private bool HandleRegisterMember(RegisterMemberAction action) { Member member = action.Member; try { this.registry.GetContract(member.Address); } catch (KeyNotFoundException) { this.registry.RegisterContract(member); } return(this.membersAddresses.Add(member.Address)); }