예제 #1
0
        public void FillMainInfo_CorrectValues()
        {
            IntermediateItem info = new IntermediateItem();

            IntermediateMapper.FillMainInfo(info, 3, 6, uint.MaxValue);

            Assert.AreEqual(3, info.Order);
            Assert.AreEqual(6u, info.StartVer);
            Assert.AreEqual(uint.MaxValue, info.EndVer);
        }
예제 #2
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);
        }
예제 #3
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);
        }
        static bool FillItemFromAttributes(IntermediateItem dest, MemberInfo info, object[] attributes)
        {
            dest.Details.Unprocessed = info;

            bool loadedSaveAttribute = false;

            for (int i = 0; i < attributes.Length; i++)
            {
                // TODO: Add more attributes
                switch (attributes[i])
                {
                case SaveAttribute save:
                    IntermediateMapper.FillMainInfo(dest, save.Order, save.FromVer, save.ToVer);
                    loadedSaveAttribute = true;
                    break;
                }
            }

            return(loadedSaveAttribute);
        }