本文整理汇总了C#中Builder.Verify方法的典型用法代码示例。如果您正苦于以下问题:C# Builder.Verify方法的具体用法?C# Builder.Verify怎么用?C# Builder.Verify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Builder
的用法示例。
在下文中一共展示了Builder.Verify方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: When_event_name_changed_should_be_reported
public void When_event_name_changed_should_be_reported()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class().Event("Event1", typeof(int)).Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Class().Event("Event2", typeof(int)).Build().Build();
var sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddRemovedItem(ResultContext.Event, "Event1", It.IsAny<Severity>()), Times.Once);
sut.Verify(result => result.AddAddedItem(ResultContext.Event, "Event2", It.IsAny<Severity>()), Times.Once);
}
示例2: When_property_has_no_setter_and_getter_should_report
public void When_property_has_no_setter_and_getter_should_report()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class().Property("MyProp", typeof(int), false).Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Class().Property("MyProp", typeof(int), hasGetter: false).Build().Build();
Mock<IComparerResult> sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddChangedFlag("Setter", false, Severity.Error), Times.Once);
sut.Verify(result => result.AddChangedFlag("Getter", true, Severity.Error), Times.Once);
}
示例3: When_field_name_has_changed_should_report
public void When_field_name_has_changed_should_report()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class().Field("Field1", typeof(int)).Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Class().Field("Field2", typeof(int)).Build().Build();
var sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddAddedItem(ResultContext.Field, "Field2", It.IsAny<Severity>()), Times.Once);
sut.Verify(result => result.AddRemovedItem(ResultContext.Field, "Field1", It.IsAny<Severity>()), Times.Once);
}
示例4: When_comparing_types_with_same_generic_parameters_should_not_report
public void When_comparing_types_with_same_generic_parameters_should_not_report()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class("MyClass`1").GenericParameter("T").Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Class("MyClass`1").GenericParameter("T").Build().Build();
var sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddAddedItem(ResultContext.Class, It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddRemovedItem(ResultContext.Class, It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
}
示例5: When_comparing_types_fullName_is_used
public void When_comparing_types_fullName_is_used()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class("Class1").Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Class("Sub.Class1").Build().Build();
var sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddAddedItem(ResultContext.Class, "Sub.Class1", It.IsAny<Severity>()), Times.Once);
sut.Verify(result => result.AddRemovedItem(ResultContext.Class, "Class1", It.IsAny<Severity>()), Times.Once);
}
示例6: When_static_flag_changed_should_report
public void When_static_flag_changed_should_report()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class().Constructor(MethodAttributes.Public | MethodAttributes.Static).Build().Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Class().Constructor().Build().Build().Build();
Mock<IComparerResult> sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(report => report.AddAddedItem(ResultContext.Constructor, It.IsAny<string>(), Severity.Warning), Times.Once);
sut.Verify(report => report.AddRemovedItem(ResultContext.Constructor, It.IsAny<string>(), Severity.Error), Times.Once);
}
示例7: When_class_is_changed_to_enum_changed_attributes_are_reported
public void When_class_is_changed_to_enum_changed_attributes_are_reported()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class("Class").Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Enum("Class").Build();
var sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddChangedFlag("Enum", false, Severity.Error), Times.Once);
sut.Verify(result => result.AddChangedFlag("Sealed", false, Severity.Error), Times.Once);
sut.Verify(result => result.AddChangedFlag(It.IsNotIn(new[] { "Enum", "Sealed" }), It.IsAny<bool>(), It.IsAny<Severity>()), Times.Never);
}
示例8: When_comparing_types_with_different_generic_params_they_are_not_compared
public void When_comparing_types_with_different_generic_params_they_are_not_compared()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class("MyClass`2").GenericParameter("T").GenericParameter("B").Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Class("MyClass`1").GenericParameter("T").Build().Build();
var sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddAddedItem(ResultContext.Class, It.IsAny<string>(), It.IsAny<Severity>()), Times.Once);
sut.Verify(result => result.AddRemovedItem(ResultContext.Class, It.IsAny<string>(), It.IsAny<Severity>()), Times.Once);
}
示例9: When_assembly_properties_changed_the_report_contains_the_changes
public void When_assembly_properties_changed_the_report_contains_the_changes()
{
Assembly assembly1 = ApiBuilder.CreateApi().Build();
Assembly assembly2 = ApiBuilder.CreateApi("AssemblyName2", "1.0.0.2", "en-US").Build();
var sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddChangedProperty(It.IsAny<string>(), It.IsAny<string>(), "AssemblyName2", Severity.Error), Times.Once);
sut.Verify(result => result.AddChangedProperty(It.IsAny<string>(), It.IsAny<string>(), "en-US", Severity.Warning), Times.Once);
sut.Verify(result => result.AddChangedProperty(It.IsAny<string>(), It.IsAny<string>(), "1.0.0.2", Severity.Hint), Times.Once);
}
示例10: When_nothing_changed_should_not_report
public void When_nothing_changed_should_not_report()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class().Constructor().Build().Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Class().Constructor().Build().Build().Build();
Mock<IComparerResult> sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(report => report.AddAddedItem(ResultContext.Constructor, It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(report => report.AddRemovedItem(ResultContext.Constructor, It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(report => report.AddComparerResult(It.IsAny<IComparerResult>()), Times.Once);
}
示例11: When_comparing_enum_values_with_equal_numeric_value_should_not_report_anything
public void When_comparing_enum_values_with_equal_numeric_value_should_not_report_anything()
{
Assembly assembly1 = ApiBuilder.CreateApi().Enum("MyEnum", new[] { Tuple.Create("Value1", 1) }).Build();
Assembly assembly2 = ApiBuilder.CreateApi().Enum("MyEnum", new[] { Tuple.Create("Value1", 1) }).Build();
Mock<IComparerResult> sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddAddedItem(It.IsAny<ResultContext>(), It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddChangedFlag(It.IsAny<string>(), It.IsAny<bool>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddChangedProperty(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddComparerResult(It.IsAny<IComparerResult>()), Times.Never);
sut.Verify(result => result.AddRemovedItem(It.IsAny<ResultContext>(), It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
}
示例12: When_comparing_equal_type_should_not_report_anything
public void When_comparing_equal_type_should_not_report_anything()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class().Field("MyField", typeof(int)).Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Class().Field("MyField", typeof(int)).Build().Build();
Mock<IComparerResult> sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddAddedItem(It.IsAny<ResultContext>(), It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddChangedFlag(It.IsAny<string>(), It.IsAny<bool>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddChangedProperty(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddComparerResult(It.IsAny<IComparerResult>()), Times.Never);
sut.Verify(result => result.AddRemovedItem(It.IsAny<ResultContext>(), It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
}
示例13: When_assemblies_are_equal_no_reports_are_generated
public void When_assemblies_are_equal_no_reports_are_generated()
{
Assembly assembly1 = ApiBuilder.CreateApi().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Build();
var sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddChangedProperty(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddRemovedItem(It.IsAny<ResultContext>(), It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddAddedItem(It.IsAny<ResultContext>(), It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddChangedFlag(It.IsAny<string>(), It.IsAny<bool>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddComparerResult(It.IsAny<ComparerResult>()), Times.Never);
}
示例14: When_event_hasnt_changed_nothing_should_be_reported
public void When_event_hasnt_changed_nothing_should_be_reported()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class().Event("MyEvent", typeof(PropertyChangedEventHandler)).Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Class().Event("MyEvent", typeof(PropertyChangedEventHandler)).Build().Build();
Mock<IComparerResult> sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddAddedItem(It.IsAny<ResultContext>(), It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddChangedFlag(It.IsAny<string>(), It.IsAny<bool>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddChangedProperty(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
sut.Verify(result => result.AddComparerResult(It.IsAny<IComparerResult>()), Times.Never);
sut.Verify(result => result.AddRemovedItem(It.IsAny<ResultContext>(), It.IsAny<string>(), It.IsAny<Severity>()), Times.Never);
}
示例15: When_class_is_changed_to_interface_changed_attributes_are_reported
public void When_class_is_changed_to_interface_changed_attributes_are_reported()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class("Class").Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Interface("Class").Build().Build();
var sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddChangedFlag("Interface", false, Severity.Error), Times.Once);
}