public void Not_Equal_When_GnMwHs_Is_Different()
        {
            var x = new GenericComposition
            {
                GnMomH = 1,
                GnMwHs = SubstanceIndication.H,
                GnNkPk = 2,
                GsKode = 3,
                MutKod = MutKod.RecordUpdated,
                XnMomE = 4,
                XpEhHv = 5
            };
            var y = new GenericComposition
            {
                GnMomH = 1,
                GnMwHs = SubstanceIndication.W,
                GnNkPk = 2,
                GsKode = 3,
                MutKod = MutKod.RecordUpdated,
                XnMomE = 4,
                XpEhHv = 5
            };

            var comparer = new GenericCompositionComparer();
            bool result = comparer.Equals(x, y);
            Assert.IsFalse(result);
        }
        public void Equal_When_All_Fields_Are_Equal()
        {
            var x = new GenericComposition
            {
                GnMomH = 1,
                GnMwHs = SubstanceIndication.H,
                GnNkPk = 2,
                GsKode = 3,
                MutKod = MutKod.RecordUpdated,
                XnMomE = 4,
                XpEhHv = 5

            };
            var y = new GenericComposition
            {
                GnMomH = 1,
                GnMwHs = SubstanceIndication.H,
                GnNkPk = 2,
                GsKode = 3,
                MutKod = MutKod.RecordUpdated,
                XnMomE = 4,
                XpEhHv = 5
            };

            var comparer = new GenericCompositionComparer();
            bool result = comparer.Equals(x, y);
            Assert.IsTrue(result);
        }
        public void Copy_All_Fields_From_One_To_Another()
        {
            var from = new GenericComposition
            {
                GnMomH = 1,
                GnMwHs = SubstanceIndication.H,
                GnNkPk = 2,
                GsKode = 3,
                MutKod = MutKod.RecordUpdated,
                XnMomE = 4,
                XpEhHv = 5
            };
            var to = new GenericComposition();

            from.CopyTo(to);

            Assert.IsTrue(new GenericCompositionComparer().Equals(from, to));
        }
        public void Return_True_On_IsIdentical_When_Identity_Is_Equal()
        {
            var x = new GenericComposition
            {
                GnMwHs = SubstanceIndication.H,
                GnNkPk = 1,
                GsKode = 2
            };
            var y = new GenericComposition
            {
                GnMwHs = SubstanceIndication.H,
                GnNkPk = 1,
                GsKode = 2
            };

            Assert.IsTrue(x.IsIdentical(y));
        }
        public void Return_False_On_IsIdentical_When_GsKode_Is_Different()
        {
            var x = new GenericComposition
            {
                GnMwHs = SubstanceIndication.H,
                GnNkPk = 1,
                GsKode = 2
            };
            var y = new GenericComposition
            {
                GnMwHs = SubstanceIndication.H,
                GnNkPk = 1,
                GsKode = 3
            };

            Assert.IsFalse(x.IsIdentical(y));
        }
        public void Return_Correct_HashCode_From_GnMwHs_GsKode_GnNkPk()
        {
            var genericComposition = new GenericComposition
            {
                GnMomH = 1,
                GnMwHs = SubstanceIndication.H,
                GnNkPk = 2,
                GsKode = 3,
                MutKod = MutKod.RecordUpdated,
                XnMomE = 4,
                XpEhHv = 5
            };

            int expectedHashCode = genericComposition.GnMomH.GetHashCode() ^ (byte)genericComposition.GnMwHs ^
                                   genericComposition.GnNkPk ^ genericComposition.GsKode ^
                                   (byte)genericComposition.MutKod ^ genericComposition.XnMomE ^
                                   genericComposition.XpEhHv;

            var comparer = new GenericCompositionComparer();
            int result = comparer.GetHashCode(genericComposition);

            Assert.AreEqual(expectedHashCode, result);
        }