Exemple #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = (Marca != null ? Marca.GetHashCode() : 0);
         result = (result * 397) ^ (Descripcion != null ? Descripcion.GetHashCode() : 0);
         return(result);
     }
 }
        public override int GetHashCode()
        {
            var hashCor    = Cor.GetHashCode();
            var hashModelo = Modelo.GetHashCode();
            var hashMarca  = Marca.GetHashCode();
            var hashAno    = Ano.GetHashCode();
            var hashMaster = (hashCor + hashModelo) - (hashMarca + hashAno);

            return(hashMaster);
        }
Exemple #3
0
        public void MarcaWhenSameDescripcionSameHashCode()
        {
            var oldMarca = new Marca {
                Descripcion = "Descripcion 1"
            };
            var newMarca = new Marca {
                Descripcion = "Descripcion 1"
            };

            oldMarca.GetHashCode().Should().Be(newMarca.GetHashCode());
        }
Exemple #4
0
        protected override int GetHashCodeCore()
        {
            unchecked
            {
                int hashCode = Marca.GetHashCode();
                hashCode = (hashCode * 397) ^ Modelo.GetHashCode();
                hashCode = (hashCode * 397) ^ AnoModelo.GetHashCode();
                hashCode = (hashCode * 397) ^ AnoFabricacao.GetHashCode();

                return(hashCode);
            }
        }