public void ConventionPickedUpped()
        {
            var configuration = new ConventionConfiguration();

            var entityConventions = configuration.ConventionMatchers;

            Assert.True(entityConventions.
                        SingleOrDefault(x => x.GetType() == typeof(MockEntityInterfaceConventionMatcher)) != null);
        }
        public void ApplyConfiguration(Action <ConventionConfiguration> conventionConfiguration)
        {
            if (conventionConfiguration == null)
            {
                throw new ArgumentNullException(nameof(conventionConfiguration));
            }
            var configuration = new ConventionConfiguration(_conventions);

            conventionConfiguration.Invoke(configuration);
        }
Ejemplo n.º 3
0
        public void ApplyConfiguration(Action <ViolationConfiguration> violationConfiguration)
        {
            if (violationConfiguration == null)
            {
                throw new ArgumentNullException("violationConfiguration");
            }
            var conventionsConfiguration = new ConventionConfiguration(_conventions);
            var configuration            = new ViolationConfiguration(conventionsConfiguration);

            violationConfiguration.Invoke(configuration);
        }
        public void CustomInterfaceConventionPickedUppedAndMatchesEntity
            (Type propertyType, string propertyName, Type conventionType)
        {
            var entityMock = MockUtilities.CreateEntityMock(propertyType, propertyName);

            var configuration = new ConventionConfiguration();

            var elements = configuration.ConventionMatchers.FindApplicableConventions(entityMock.Object).ToList();

            Assert.Single(elements);

            Assert.Equal(conventionType, (elements.Single() as InterfaceElement)?.InterfaceType);
        }
        public void ConventionPickedUppedAndMatchesEntity()
        {
            var entityMock = MockUtilities.CreateEntityMock(typeof(string), "Something");

            MockEntityInterfaceConventionMatcher.AppliesToEntityFunction = e =>
                                                                           e == entityMock.Object ? new InterfaceElement(typeof(IDummyInterface1)) : null;

            var configuration = new ConventionConfiguration();

            var elements = configuration.ConventionMatchers.FindApplicableConventions(entityMock.Object).ToList();

            Assert.Single(elements);

            Assert.Equal(typeof(IDummyInterface1), (elements.Single() as InterfaceElement)?.InterfaceType);
        }
        public void DefaultEditorsAreCorrect()
        {
            var configuration = new ConventionConfiguration();

            var actual = configuration.EntityEditors;

            var expected = new IEntityEditor[]
            {
                new NamespaceEditor(),
                new InterfaceEditor(),
                new PropertyAttributeEditor()
            };


            Assert.Equal(expected.Length, actual.Count);

            for (int i = 0; i < expected.Length; i++)
            {
                Assert.Equal(expected[i].GetType(), actual[i].GetType());
            }
        }
Ejemplo n.º 7
0
 public QueryConditionExpressionModelBinder(ConventionConfiguration conventionConfiguration)
 {
     _conventionConfiguration = conventionConfiguration;
 }