Exemple #1
0
        public void EntityConstructorViewFactoryShouldNotCreateOnlyForNonManyMultiplicity()
        {
            var sampleFactoryGenerator = new SampleGeneratorFactory(
                CodeFirstGen.OneToMany.Csdl(),
                CodeFirstGen.OneToMany.Ssdl(),
                CodeFirstGen.OneToMany.Msdl());

            var postConceptualEntityType = sampleFactoryGenerator.ConceptualItemCollection
                                           .OfType <EntityType>()
                                           .Single(x => x.Name == "Tag");

            var testSubject = new EntityConstructorViewFactory(new CodeGenEscaper());

            var views = testSubject.Create(postConceptualEntityType).ToArray();

            views.Should().BeEmpty();
        }
Exemple #2
0
        public void EntityConstructorViewFactoryShouldCreateOnlyForManyMultiplicity()
        {
            var sampleFactoryGenerator = new SampleGeneratorFactory(
                CodeFirstGen.OneToMany.Csdl(),
                CodeFirstGen.OneToMany.Ssdl(),
                CodeFirstGen.OneToMany.Msdl());

            var postConceptualEntityType = sampleFactoryGenerator.ConceptualItemCollection
                                           .OfType <EntityType>()
                                           .Single(x => x.Name == "Post");

            var testSubject = new EntityConstructorViewFactory(new CodeGenEscaper());

            var views = testSubject.Create(postConceptualEntityType).ToArray();

            views.Should().HaveCount(1);
            views[0].Name.Should().Be("Tags");
            views[0].TypeName.Should().Be("global::System.Collections.Generic.List<Tag>");
        }