Beispiel #1
0
        public void FillMainInfo_CorrectHighestVersion_CustomHighs()
        {
            var ctx = new IntermediateMappingContext();

            IntermediateItem info = new IntermediateItem();

            IntermediateMapper.FillMainInfo(info, 3, 6, 7);
            IntermediateMapper.UpdateContextFromItem(ref ctx, info);

            IntermediateMapper.FillMainInfo(info, 5, 8, 34);
            IntermediateMapper.UpdateContextFromItem(ref ctx, info);

            IntermediateMapper.FillMainInfo(info, 9, 11, 59);
            IntermediateMapper.UpdateContextFromItem(ref ctx, info);

            Assert.AreEqual(9, ctx.TranslationCurrentOrderInfo);
            Assert.AreEqual(59u, ctx.HighestVersion);
        }
Beispiel #2
0
        public void FillMainInfo_CorrectOrderInfo_Ordered()
        {
            Setup();

            var ctx = new IntermediateMappingContext();

            IntermediateItem info = new IntermediateItem();

            IntermediateMapper.FillMainInfo(info, 3, 0, uint.MaxValue);
            IntermediateMapper.UpdateContextFromItem(ref ctx, info);

            IntermediateMapper.FillMainInfo(info, 5, 0, uint.MaxValue);
            IntermediateMapper.UpdateContextFromItem(ref ctx, info);

            IntermediateMapper.FillMainInfo(info, 9, 0, uint.MaxValue);
            IntermediateMapper.UpdateContextFromItem(ref ctx, info);

            Assert.AreEqual(9, ctx.TranslationCurrentOrderInfo);
        }
        internal static IntermediateItem?GetItemForMember(ref IntermediateMappingContext ctx, MemberInfo info)
        {
            // Get the attributes - skip this item if there are none
            object[]? attributes = info.GetCustomAttributes(typeof(SaveAttribute), false);
            if (attributes.Length == 0)
            {
                return(null);
            }

            var newItem = new IntermediateItem();

            // Create the item.
            bool successful = FillItemFromAttributes(newItem, info, attributes);

            if (!successful)
            {
                throw new IncompleteDetailsException(info);
            }

            IntermediateMapper.UpdateContextFromItem(ref ctx, newItem);
            return(newItem);
        }