Exemplo n.º 1
0
        public void IgnoreGetOnlyPropertiesInFkProxy()
        {
            // assemble
            var target = MakeTarget();
            var maps   = MakeMaps(typeof(ClassWithGetOnlyProperty), typeof(ClassWithNonVirtualProperty));
            var config = new CodeGeneratorConfig();

            // act
            var results = target.GenerateProxies(config, maps);

            // assert
            Assert.NotNull(results);
            var fkProxy = results.ProxyTypes.Single(ctd => ctd.Name == typeof(ClassWithNonVirtualProperty).Name + config.ForeignKeyAccessClassSuffix);
            var members = new CodeTypeMember[fkProxy.Members.Count];

            fkProxy.Members.CopyTo(members, 0);
            Assert.False(members.Any(m => m.Name == "NonVirtualGetOnlyProperty"));
            Assert.False(members.Any(m => m.Name == "VirtualGetOnlyProperty"));
        }
Exemplo n.º 2
0
        public void IgnoreGetOnlyPropertiesInUpdateProxy()
        {
            // assemble
            var target = MakeTarget();
            var maps   = MakeMaps(typeof(ClassWithGetOnlyProperty));
            var config = new CodeGeneratorConfig();

            // act
            var results = target.GenerateProxies(config, maps);

            // assert
            Assert.NotNull(results);
            var updateProxy = results.ProxyTypes.Single(ctd => ctd.Name == typeof(ClassWithGetOnlyProperty).Name + config.UpdateClassSuffix);
            var members     = new CodeTypeMember[updateProxy.Members.Count];

            updateProxy.Members.CopyTo(members, 0);
            Assert.False(members.Any(m => m.Name == "Id"));
        }