Example #1
0
        public void Create_initialize_from_instance_nominal()
        {
            var expected = new PImmutable();
            var t        = Template.Create(new StatusBuilder {
                Component = expected, ErrorCode = 0xdead
            });

            StatusBuilder sb = new StatusBuilder();

            t.Apply(sb);

            Assert.Equal(0xdead, sb.ErrorCode);
            Assert.Equal(expected, sb.Component);
        }
Example #2
0
        public void Initialize_should_copy_from_nominals()
        {
            Assume.True(Template.IsImmutable(typeof(PImmutable)));
            var asm = new PImmutable();

            Dictionary <string, object> values = new Dictionary <string, object>()
            {
                { "Component", asm },
                { "ErrorCode", 0xdead },
            };

            StatusBuilder sb = new StatusBuilder();

            Activation.Initialize(sb, values);

            Assert.Equal(0xdead, sb.ErrorCode);
            Assert.Equal(asm, sb.Component);
        }