コード例 #1
0
        public void Add_should_append_convention_on_to_internal_list()
        {
            var mockConvention1 = new Mock<IConvention>();
            var mockConvention2 = new Mock<IConvention>();
            var conventionsConfiguration = new ConventionsConfiguration(new[] { mockConvention1.Object });

            conventionsConfiguration.Add(mockConvention2.Object);

            Assert.Equal(2, conventionsConfiguration.Conventions.Count());
            Assert.Same(mockConvention2.Object, conventionsConfiguration.Conventions.Last());
        }
コード例 #2
0
        public void Add_should_append_convention_on_to_internal_list()
        {
            var mockConvention1          = new Mock <IConvention>();
            var mockConvention2          = new Mock <IConvention>();
            var conventionsConfiguration = new ConventionsConfiguration(new[] { mockConvention1.Object });

            conventionsConfiguration.Add(mockConvention2.Object);

            Assert.Equal(2, conventionsConfiguration.Conventions.Count());
            Assert.Same(mockConvention2.Object, conventionsConfiguration.Conventions.Last());
        }
コード例 #3
0
        public void Cloning_the_conventions_configuration_clones_the_list_of_conventions_but_not_the_conventions_themselves()
        {
            var convention1 = new Mock <IConvention>().Object;
            var conventions = new ConventionsConfiguration(
                new List <IConvention>
            {
                convention1
            });

            Assert.Same(conventions.Conventions, conventions.Conventions);

            var clone       = conventions.Clone();
            var convention2 = new Mock <IConvention>().Object;

            conventions.Add(convention2);

            Assert.NotSame(conventions.Conventions, clone.Conventions);
            Assert.True(clone.Conventions.Contains(convention1));
            Assert.False(clone.Conventions.Contains(convention2));
        }
コード例 #4
0
 /// <summary>
 /// 配置数据校验和类型转换
 /// </summary>
 /// <param name="convertions"></param>
 public static void ConfigConvertions(ConventionsConfiguration convertions)
 {
     convertions.Add(new DecimalAttributeConvention());
 }