Ejemplo n.º 1
0
        public void GetNameForAttribute_WhenNotUsingDisplayNames_ReturnsDefault()
        {
            namingService.GetNameForAttribute(Arg.Any <EntityMetadata>(), Arg.Any <AttributeMetadata>(), serviceProvider)
            .Returns("Name");
            parameters = new Dictionary <string, string> {
                { "UseDisplayNames", false.ToString() }
            };

            sut = new CodeNamingService(namingService, parameters);

            var result = sut.GetNameForAttribute(new EntityMetadata(), new AttributeMetadata(), serviceProvider);

            Assert.AreEqual(result, "Name");
        }
Ejemplo n.º 2
0
        public void TestInitialise()
        {
            metadataProviderService = Substitute.For <IMetadataProviderService>();
            organizationMetadata    = Substitute.For <IOrganizationMetadata>();
            metadataProviderService.LoadMetadata().Returns(organizationMetadata);
            serviceProvider.GetService(typeof(IMetadataProviderService)).Returns(metadataProviderService);

            namingService = Substitute.For <INamingService>();
            parameters    = new Dictionary <string, string> {
                { "UseDisplayNames", true.ToString() }
            };

            testMetadata = new TestMetadata(filterService);

            organizationMetadata.Entities.Returns(testMetadata.ToArray());

            sut = new CodeNamingService(namingService, parameters);
        }