Beispiel #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");
        }
Beispiel #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");
        }
Beispiel #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");
        }
Beispiel #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);
        }
Beispiel #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");
        }