Ejemplo n.º 1
0
        public void Create_name_for_enumerable_primitives_test()
        {
            var ctx    = new TestBuildContext();
            var output = FieldBuilder.Create(typeof(int[]), "test", ctx);

            output.CreateNames();
            output.CreateNames();

            ctx.Names.Count.Should().BeGreaterOrEqualTo(1);
            ctx.Names.Keys.Should().Contain("_value");
        }
Ejemplo n.º 2
0
        public void Create_name_for_primitives_test()
        {
            var ctx    = new TestBuildContext();
            var output = FieldBuilder.Create(typeof(int), "test", ctx);

            output.CreateNames();
            output.CreateNames();

            ctx.Names.Count.Should().Be(1);
            ctx.Names.Keys.Should().Contain("test");
        }
Ejemplo n.º 3
0
        public void Create_name_for_complex_test()
        {
            var ctx    = new TestBuildContext();
            var output = FieldBuilder.Create(typeof(TestEntity), "test", ctx);

            output.CreateNames();
            output.CreateNames();

            ctx.Names.Count.Should().BeGreaterOrEqualTo(7);
            ctx.Names.Keys.Should().Contain("test_Age");
            ctx.Names.Keys.Should().Contain("test_Address_City");
            ctx.Names.Keys.Should().Contain("_value");
        }
Ejemplo n.º 4
0
        public void Set_value_for_primitive_test()
        {
            var ctx    = new TestBuildContext();
            var output = FieldBuilder.Create(typeof(string), "test", ctx);

            output.CreateNames();

            output.SetValue("test value");
            ctx.Names["test"].Should().Be("test value");

            output.SetValue(2);
            ctx.Names["test"].Should().Be(2);
        }
Ejemplo n.º 5
0
        public void Set_value_for_complex_test()
        {
            var ctx    = new TestBuildContext();
            var output = FieldBuilder.Create(typeof(TestEntity), "test", ctx);

            output.CreateNames();

            output.SetValue(new TestEntity("test name", "test role", 36, new [] { 23, 42 })
            {
                Address = new Address("RUS", "SPB", "Nevskiy")
            });
            ctx.Names["test_Name"].Should().Be("test name");
            ctx.Names["test_Role"].Should().Be("test role");
            ctx.Names["test_Age"].Should().Be(36);
            ctx.Names["test_Address_City"].Should().Be("SPB");
        }