Exemplo n.º 1
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                if ((this._parent.StreetAddress == null))
                {
                    IStreetAddress streetAddressCasted = item.As <IStreetAddress>();
                    if ((streetAddressCasted != null))
                    {
                        this._parent.StreetAddress = streetAddressCasted;
                        return;
                    }
                }
                if ((this._parent.ElectronicAddress == null))
                {
                    IElectronicAddress electronicAddressCasted = item.As <IElectronicAddress>();
                    if ((electronicAddressCasted != null))
                    {
                        this._parent.ElectronicAddress = electronicAddressCasted;
                        return;
                    }
                }
                if ((this._parent.PostalAddress == null))
                {
                    IPostalAddress postalAddressCasted = item.As <IPostalAddress>();
                    if ((postalAddressCasted != null))
                    {
                        this._parent.PostalAddress = postalAddressCasted;
                        return;
                    }
                }
                if ((this._parent.Phone1 == null))
                {
                    ITelephoneNumber phone1Casted = item.As <ITelephoneNumber>();
                    if ((phone1Casted != null))
                    {
                        this._parent.Phone1 = phone1Casted;
                        return;
                    }
                }
                if ((this._parent.Phone2 == null))
                {
                    ITelephoneNumber phone2Casted = item.As <ITelephoneNumber>();
                    if ((phone2Casted != null))
                    {
                        this._parent.Phone2 = phone2Casted;
                        return;
                    }
                }
                IMarketRole marketRolesCasted = item.As <IMarketRole>();

                if ((marketRolesCasted != null))
                {
                    this._parent.MarketRoles.Add(marketRolesCasted);
                }
                IBusinessRole businessRolesCasted = item.As <IBusinessRole>();

                if ((businessRolesCasted != null))
                {
                    this._parent.BusinessRoles.Add(businessRolesCasted);
                }
            }
Exemplo n.º 2
0
        // class to describe a collection of objects
        // http://msdn2.microsoft.com/en-us/library/xth2y6ft(VS.71).aspx
        /// <summary>
        ///     Adds an item to the collection
        /// </summary>
        /// <param name="item">The item to be added</param>
        /// <remarks>Adds an item to the base class list object</remarks>
        public void Add(ITelephoneNumber item)
        {
            // Invokes Add method of the List object
            if (item == null)
            {
                return;
            }

            List.Add(item);
        }
Exemplo n.º 3
0
        public void Add_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            var telephoneNumbers  = new TelephoneNumbers();
            ITelephoneNumber item = null;

            // Act
            telephoneNumbers.Add(
                // ReSharper disable once ExpressionIsAlwaysNull
                item);

            // Assert
            Assert.That(telephoneNumbers.Count, Is.EqualTo(0));
        }
Exemplo n.º 4
0
 public ContactInfo(IAddress address, IEmailAddress email, ITelephoneNumber phoneNumber)
 {
     this.Address         = address;
     this.EmailAddress    = email;
     this.TelephoneNumber = phoneNumber;
 }