Ejemplo n.º 1
0
    public void CanCreateEquivalentAliasWithDifferentConstructors()
    {
        var(publicKey, _) = Generator.KeyPair();
        var endorsement = new Endorsement(publicKey);
        var alias1      = new Alias(publicKey);
        var alias2      = new Alias(endorsement);
        var alias3      = new Alias(0, 0, publicKey);
        var alias4      = new Alias(0, 0, endorsement);

        Assert.Equal(alias1, alias2);
        Assert.Equal(alias1, alias3);
        Assert.Equal(alias1, alias4);
        Assert.Equal(alias2, alias3);
        Assert.Equal(alias2, alias4);
        Assert.Equal(alias3, alias4);
        Assert.True(alias1 == alias2);
        Assert.True(alias1 == alias3);
        Assert.True(alias1 == alias4);
        Assert.True(alias2 == alias3);
        Assert.True(alias2 == alias4);
        Assert.True(alias3 == alias4);
        Assert.False(alias1 != alias2);
        Assert.False(alias1 != alias3);
        Assert.False(alias1 != alias4);
        Assert.False(alias2 != alias3);
        Assert.False(alias2 != alias4);
        Assert.False(alias3 != alias4);
        Assert.True(alias1.Equals(alias2));
        Assert.True(alias1.Equals(alias3));
        Assert.True(alias1.Equals(alias4));
        Assert.True(alias2.Equals(alias3));
        Assert.True(alias2.Equals(alias4));
        Assert.True(alias3.Equals(alias4));
    }
Ejemplo n.º 2
0
    public void NullAliasesAreNotConsideredEqual()
    {
        object asNull   = null;
        var    shardNum = Generator.Integer(0, 200);
        var    realmNum = Generator.Integer(0, 200);

        var(publicKey, _) = Generator.KeyPair();
        var alias = new Alias(shardNum, realmNum, publicKey);

        Assert.False(alias == null);
        Assert.False(null == alias);
        Assert.True(alias != null);
        Assert.False(alias.Equals(null));
        Assert.False(alias.Equals(asNull));
    }
        /// <summary>
        /// Adds a content type to the composition.
        /// </summary>
        /// <param name="contentType">The content type to add.</param>
        /// <returns>True if the content type was added, otherwise false.</returns>
        public bool AddContentType(IContentTypeComposition contentType)
        {
            if (contentType.ContentTypeComposition.Any(x => x.CompositionAliases().Any(ContentTypeCompositionExists)))
            {
                return(false);
            }

            if (string.IsNullOrEmpty(Alias) == false && Alias.Equals(contentType.Alias))
            {
                return(false);
            }

            if (ContentTypeCompositionExists(contentType.Alias) == false)
            {
                //Before we actually go ahead and add the ContentType as a Composition we ensure that we don't
                //end up with duplicate PropertyType aliases - in which case we throw an exception.
                var conflictingPropertyTypeAliases = CompositionPropertyTypes.SelectMany(
                    x => contentType.CompositionPropertyTypes
                    .Where(y => y.Alias.Equals(x.Alias, StringComparison.InvariantCultureIgnoreCase))
                    .Select(p => p.Alias)).ToList();

                if (conflictingPropertyTypeAliases.Any())
                {
                    throw new InvalidCompositionException(Alias, contentType.Alias, conflictingPropertyTypeAliases.ToArray());
                }

                _contentTypeComposition.Add(contentType);
                OnPropertyChanged(Ps.Value.ContentTypeCompositionSelector);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 4
0
 public bool Equals(CommittedBlock other)
 {
     return(BlockHeight.Equals(other.BlockHeight) &&
            Alias.Equals(other.Alias) &&
            Parent.Equals(other.Parent) &&
            BlockId.Equals(other.BlockId));
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Returns true if OrgApacheSlingJcrDavexImplServletsSlingDavExServletProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheSlingJcrDavexImplServletsSlingDavExServletProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheSlingJcrDavexImplServletsSlingDavExServletProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Alias == other.Alias ||
                     Alias != null &&
                     Alias.Equals(other.Alias)
                     ) &&
                 (
                     DavCreateAbsoluteUri == other.DavCreateAbsoluteUri ||
                     DavCreateAbsoluteUri != null &&
                     DavCreateAbsoluteUri.Equals(other.DavCreateAbsoluteUri)
                 ) &&
                 (
                     DavProtectedhandlers == other.DavProtectedhandlers ||
                     DavProtectedhandlers != null &&
                     DavProtectedhandlers.Equals(other.DavProtectedhandlers)
                 ));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Returns true if Name instances are equal
        /// </summary>
        /// <param name="other">Instance of Name to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Name other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Uuid == other.Uuid ||
                     Uuid != null &&
                     Uuid.Equals(other.Uuid)
                     ) &&
                 (
                     Alias == other.Alias ||
                     Alias != null &&
                     Alias.Equals(other.Alias)
                 ) &&
                 (
                     First == other.First ||
                     First != null &&
                     First.Equals(other.First)
                 ) &&
                 (
                     Family == other.Family ||
                     Family != null &&
                     Family.Equals(other.Family)
                 ) &&
                 (
                     Given == other.Given ||
                     Given != null &&
                     Given.SequenceEqual(other.Given)
                 ) &&
                 (
                     Prefix == other.Prefix ||
                     Prefix != null &&
                     Prefix.SequenceEqual(other.Prefix)
                 ) &&
                 (
                     Suffix == other.Suffix ||
                     Suffix != null &&
                     Suffix.SequenceEqual(other.Suffix)
                 ) &&
                 (
                     Creation == other.Creation ||
                     Creation != null &&
                     Creation.Equals(other.Creation)
                 ) &&
                 (
                     LastUpdated == other.LastUpdated ||
                     LastUpdated != null &&
                     LastUpdated.Equals(other.LastUpdated)
                 ));
        }
Ejemplo n.º 7
0
        public override bool Equals(object other)
        {
            if (!(other is NullConstant otherNC))
            {
                return(false);
            }

            return(Alias.Equals(otherNC.Alias));
        }
Ejemplo n.º 8
0
    public void DisimilarAliasesAreNotConsideredEqual()
    {
        var shardNum = Generator.Integer(0, 200);
        var realmNum = Generator.Integer(0, 200);

        var(publicKey1, _) = Generator.KeyPair();
        var(publicKey2, _) = Generator.KeyPair();
        var alias1 = new Alias(shardNum, realmNum, publicKey1);

        Assert.NotEqual(alias1, new Alias(shardNum, realmNum + 1, publicKey1));
        Assert.NotEqual(alias1, new Alias(shardNum + 1, realmNum, publicKey1));
        Assert.NotEqual(alias1, new Alias(shardNum, realmNum, publicKey2));
        Assert.False(alias1 == new Alias(shardNum, realmNum, publicKey2));
        Assert.True(alias1 != new Alias(shardNum, realmNum, publicKey2));
        Assert.False(alias1.Equals(new Alias(shardNum + 1, realmNum, publicKey1)));
        Assert.False(alias1.Equals(new Alias(shardNum, realmNum + 1, publicKey1)));
        Assert.False(alias1.Equals(new Alias(shardNum, realmNum, publicKey2)));
    }
Ejemplo n.º 9
0
        public override bool Equals(object other)
        {
            if (!(other is BinaryConstant otherBC))
            {
                return(false);
            }

            return(Alias.Equals(otherBC.Alias) &&
                   binvalue.SequenceEqual(otherBC.binvalue));
        }
Ejemplo n.º 10
0
        public override bool Equals(object other)
        {
            if (!(other is DecimalConstant otherIC))
            {
                return(false);
            }

            return(Alias.Equals(otherIC.Alias) &&
                   decimalvalue == otherIC.decimalvalue);
        }
Ejemplo n.º 11
0
        public override bool Equals(object other)
        {
            if (!(other is IntConstant otherIC))
            {
                return(false);
            }

            return(Alias.Equals(otherIC.Alias) &&
                   intvalue == otherIC.intvalue);
        }
Ejemplo n.º 12
0
    public void OtherObjectsAreNotConsideredEqual()
    {
        var shardNum = Generator.Integer(0, 200);
        var realmNum = Generator.Integer(0, 200);

        var(publicKey, _) = Generator.KeyPair();
        var alias = new Alias(shardNum, realmNum, publicKey);

        Assert.False(alias.Equals("Something that is not an Alias"));
    }
Ejemplo n.º 13
0
        public bool Equals(NodeAlias rhs)
        {
            if (object.ReferenceEquals(rhs, null) || GetType() != rhs.GetType())
            {
                return(false);
            }

            return(Alias.Equals(rhs.Alias, StringComparison.OrdinalIgnoreCase) &&
                   IpAddress.Equals(rhs.IpAddress, StringComparison.OrdinalIgnoreCase));
        }
Ejemplo n.º 14
0
        public override bool Equals(object other)
        {
            if (!(other is StringConstant otherSC))
            {
                return(false);
            }

            return(Alias.Equals(otherSC.Alias) &&
                   strvalue == otherSC.strvalue);
        }
Ejemplo n.º 15
0
        public override bool Equals(object other)
        {
            if (!(other is MySqlVariable otherVar))
            {
                return(false);
            }

            return(VariableName.Equals(otherVar.VariableName) &&
                   Alias.Equals(otherVar.Alias));
        }
Ejemplo n.º 16
0
        public override bool Equals(object other)
        {
            if (!(other is PaillierAggregationSumFunction otherF))
            {
                return(false);
            }

            return(FunctionName.Equals(otherF.FunctionName) &&
                   Alias.Equals(otherF.Alias) &&
                   Parameters.SequenceEqual(otherF.Parameters));
        }
Ejemplo n.º 17
0
        public override bool Equals(object other)
        {
            if (!(other is ColumnRef otherCR))
            {
                return(false);
            }

            return(Alias.Equals(otherCR.Alias) &&
                   ColumnName.Equals(otherCR.ColumnName) &&
                   Table.Equals(otherCR.Table));
        }
Ejemplo n.º 18
0
        public override bool Equals(object other)
        {
            if (!(other is ElGamalDivisionFunction otherF))
            {
                return(false);
            }

            return(FunctionName.Equals(otherF.FunctionName) &&
                   Alias.Equals(otherF.Alias) &&
                   Parameters.SequenceEqual(otherF.Parameters));
        }
Ejemplo n.º 19
0
    public void ReferenceEqualIsconsideredEqual()
    {
        var shardNum = Generator.Integer(0, 200);
        var realmNum = Generator.Integer(0, 200);

        var(publicKey, _) = Generator.KeyPair();
        var    alias     = new Alias(shardNum, realmNum, publicKey);
        object reference = alias;

        Assert.True(alias.Equals(reference));
        Assert.True(reference.Equals(alias));
    }
Ejemplo n.º 20
0
    public void AliasCastAsObjectIsconsideredEqual()
    {
        var shardNum = Generator.Integer(0, 200);
        var realmNum = Generator.Integer(0, 200);

        var(publicKey, _) = Generator.KeyPair();
        var    alias      = new Alias(shardNum, realmNum, publicKey);
        object equivalent = new Alias(shardNum, realmNum, publicKey);

        Assert.True(alias.Equals(equivalent));
        Assert.True(equivalent.Equals(alias));
    }
Ejemplo n.º 21
0
        public bool Equals(CodeListRef other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Id.Equals(other.Id) &&
                   AgencyId.Equals(other.AgencyId) &&
                   Version.Equals(other.Version) &&
                   Alias.Equals(other.Alias));
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (!(obj is ImageCropAttribute))
            {
                return(false);
            }
            var tobj = obj as ImageCropAttribute;

            return(Alias.Equals(tobj.Alias, StringComparison.InvariantCultureIgnoreCase));
        }
Ejemplo n.º 23
0
        internal bool IsEqualsTo(ColumnInfo column)
        {
            if (column.AliasOf == column || AliasOf == column)
            {
                return(true);
            }

            if (column.IsEquivalentTo(ColumnName) && Alias.Equals(column.Alias))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Returns true if TruststoreItems instances are equal
        /// </summary>
        /// <param name="other">Instance of TruststoreItems to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(TruststoreItems other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Alias == other.Alias ||
                     Alias != null &&
                     Alias.Equals(other.Alias)
                     ) &&
                 (
                     EntryType == other.EntryType ||
                     EntryType != null &&
                     EntryType.Equals(other.EntryType)
                 ) &&
                 (
                     Subject == other.Subject ||
                     Subject != null &&
                     Subject.Equals(other.Subject)
                 ) &&
                 (
                     Issuer == other.Issuer ||
                     Issuer != null &&
                     Issuer.Equals(other.Issuer)
                 ) &&
                 (
                     NotBefore == other.NotBefore ||
                     NotBefore != null &&
                     NotBefore.Equals(other.NotBefore)
                 ) &&
                 (
                     NotAfter == other.NotAfter ||
                     NotAfter != null &&
                     NotAfter.Equals(other.NotAfter)
                 ) &&
                 (
                     SerialNumber == other.SerialNumber ||
                     SerialNumber != null &&
                     SerialNumber.Equals(other.SerialNumber)
                 ));
        }
        /// <summary>
        /// Returns true if CreateMandateBase instances are equal
        /// </summary>
        /// <param name="other">Instance of CreateMandateBase to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CreateMandateBase other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Alias == other.Alias ||
                     Alias != null &&
                     Alias.Equals(other.Alias)
                     ) &&
                 (
                     Customer == other.Customer ||
                     Customer != null &&
                     Customer.Equals(other.Customer)
                 ) &&
                 (
                     CustomerReference == other.CustomerReference ||
                     CustomerReference != null &&
                     CustomerReference.Equals(other.CustomerReference)
                 ) &&
                 (
                     Language == other.Language ||
                     Language != null &&
                     Language.Equals(other.Language)
                 ) &&
                 (
                     RecurrenceType == other.RecurrenceType ||
                     RecurrenceType != null &&
                     RecurrenceType.Equals(other.RecurrenceType)
                 ) &&
                 (
                     SignatureType == other.SignatureType ||
                     SignatureType != null &&
                     SignatureType.Equals(other.SignatureType)
                 ) &&
                 (
                     UniqueMandateReference == other.UniqueMandateReference ||
                     UniqueMandateReference != null &&
                     UniqueMandateReference.Equals(other.UniqueMandateReference)
                 ));
        }
Ejemplo n.º 26
0
    public void EquivalentAliasAreConsideredEqual()
    {
        var shardNum = Generator.Integer(0, 200);
        var realmNum = Generator.Integer(0, 200);

        var(publicKey, _) = Generator.KeyPair();
        var alias1 = new Alias(shardNum, realmNum, publicKey);
        var alias2 = new Alias(shardNum, realmNum, publicKey);

        Assert.Equal(alias1, alias2);
        Assert.True(alias1 == alias2);
        Assert.False(alias1 != alias2);
        Assert.True(alias1.Equals(alias2));
        Assert.True(alias2.Equals(alias1));
        Assert.True(null as Alias == null as Alias);
    }
Ejemplo n.º 27
0
        public bool Equals(PropertyType other)
        {
            //Check whether the compared object is null.
            if (Object.ReferenceEquals(other, null))
            {
                return(false);
            }

            //Check whether the compared object references the same data.
            if (Object.ReferenceEquals(this, other))
            {
                return(true);
            }

            //Check whether the PropertyType's properties are equal.
            return(Alias.Equals(other.Alias) && Name.Equals(other.Name));
        }
Ejemplo n.º 28
0
 public virtual bool CanExecute(InterpreterReadToken token)
 {
     if ((!string.IsNullOrEmpty(CommandNamespace) || !string.IsNullOrEmpty(token.Namespace)) &&
         CommandNamespace != token.Namespace)
     {
         return(false);
     }
     if (string.IsNullOrEmpty(token.Command))
     {
         throw new InvalidOperationException("Null command in token.");
     }
     if (!string.IsNullOrEmpty(Alias) && Alias.Equals($"{token.Identifier}{token.Command}", StringComparison.OrdinalIgnoreCase))
     {
         return(true);
     }
     return(Name.Equals($"{token.Identifier}{token.Command}", StringComparison.OrdinalIgnoreCase));
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Returns true if KeystoreItems instances are equal
        /// </summary>
        /// <param name="other">Instance of KeystoreItems to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(KeystoreItems other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Alias == other.Alias ||
                     Alias != null &&
                     Alias.Equals(other.Alias)
                     ) &&
                 (
                     EntryType == other.EntryType ||
                     EntryType != null &&
                     EntryType.Equals(other.EntryType)
                 ) &&
                 (
                     Algorithm == other.Algorithm ||
                     Algorithm != null &&
                     Algorithm.Equals(other.Algorithm)
                 ) &&
                 (
                     Format == other.Format ||
                     Format != null &&
                     Format.Equals(other.Format)
                 ) &&
                 (
                     Chain == other.Chain ||
                     Chain != null &&
                     Chain.SequenceEqual(other.Chain)
                 ));
        }
 /// <summary></summary>
 public bool Equals(NamespaceInfo other)
 {
     return(other != null &&
            Alias.Equals(other.Alias, StringComparison.OrdinalIgnoreCase) &&
            connectionString.Equals(other.connectionString));
 }