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()); }
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()); }
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)); }
/// <summary> /// 配置数据校验和类型转换 /// </summary> /// <param name="convertions"></param> public static void ConfigConvertions(ConventionsConfiguration convertions) { convertions.Add(new DecimalAttributeConvention()); }