public void TestAdd() { var set1 = AttributeSetFixture("add"); _repository.Add(set1); Assert.Equal(set1, _repository.AttributeSetOf("add")); }
internal void AddAttribute(ReceivedAttributeMessage request) { var attributeSet = _repository.AttributeSetOf(request.AttributeSetName !); if (attributeSet.IsNone) { attributeSet = AttributeSet.Named(request.AttributeSetName); _repository.Add(attributeSet); } var tracked = attributeSet.AddIfAbsent(request.Attribute()); _confirmingDistributor.Confirm(request.TrackingId, attributeSet, tracked, request.Type, _configuration.NodeMatching(request.SourceNodeId)); }
//========================================= // AttributesAgent (core) //========================================= #region AttributesAgent (core) public void Add <T>(string attributeSetName, string attributeName, T value) { var set = _repository.AttributeSetOf(attributeSetName); if (set.IsNone) { var newSet = AttributeSet.Named(attributeSetName); newSet.AddIfAbsent(Attribute <T> .From(attributeName, value)); _repository.Add(newSet); _client.SyncWith(newSet); _confirmingDistributor.DistributeCreate(newSet); } else { var newlyTracked = set.AddIfAbsent(Attribute <T> .From(attributeName, value)); if (!newlyTracked.IsDistributed) { _confirmingDistributor.Distribute(set, newlyTracked, ApplicationMessageType.AddAttribute); } } }