コード例 #1
0
        public void Load(ConfigNode node, OperationContext context)
        {
            node.ThrowIfNullArgument(nameof(node));
            context.ThrowIfNullArgument(nameof(context));

            INodeDataMapper mapper = operationManager.MapperFor(context.Operation);

            if (mapper.IsNull())
            {
                return;
            }

            object value = field.GetValue(context.Subject);

            if (mapper.Load(ref value, node, context))
            {
                field.SetValue(context.Subject, value);
            }
        }
コード例 #2
0
        public void TestLoad()
        {
            object           subject = new object();
            object           value   = new object();
            ConfigNode       node    = new ConfigNode();
            OperationContext context = new OperationContext(Operation.LoadPrefab, subject);

            fieldWrapper.GetValue(subject).Returns(value);
            operationManager.MapperFor(Operation.LoadPrefab).Returns(mapper);
            mapper.Load(ref value, node, context).Returns(true);

            field.Load(node, context);

            fieldWrapper.Received().GetValue(subject);
            mapper.Received().Load(ref value, node, context);
            fieldWrapper.Received().SetValue(subject, value);

            mapper.DidNotReceiveWithAnyArgs().Save(null, null, null);
        }