public void IgnoreField() { // arrange ITypeRewriter typeRewriter = null; var mock = new Mock <IStitchingBuilder>(); mock.Setup(t => t.AddTypeRewriter( It.IsAny <ITypeRewriter>())) .Returns(new Func <ITypeRewriter, IStitchingBuilder>(t => { typeRewriter = t; return(mock.Object); })); NameString schemaName = "Foo"; var fieldReference = new FieldReference("A", "a"); // act StitchingBuilderExtensions.IgnoreField( mock.Object, schemaName, fieldReference); // assert RemoveFieldRewriter rewriter = Assert.IsType <RemoveFieldRewriter>(typeRewriter); Assert.Equal(schemaName, rewriter.SchemaName); Assert.Equal(fieldReference.TypeName, rewriter.Field.TypeName); Assert.Equal(fieldReference.FieldName, rewriter.Field.FieldName); }
public void IgnoreField_FieldIsNull_ArgumentNullException() { // arrange var mock = new Mock <IStitchingBuilder>(); NameString schemaName = "Foo"; // act Action action = () => StitchingBuilderExtensions .IgnoreField(mock.Object, schemaName, null); // assert Assert.Equal("field", Assert.Throws <ArgumentNullException>(action).ParamName); }
public void IgnoreField_SchemaIsEmpty_ArgumentNullException() { // arrange var mock = new Mock <IStitchingBuilder>(); var fieldReference = new FieldReference("A", "a"); // act Action action = () => StitchingBuilderExtensions .IgnoreField(mock.Object, null, fieldReference); // assert Assert.Equal("schemaName", Assert.Throws <ArgumentException>(action).ParamName); }
public void IgnoreField_BuilderIsNull_ArgumentNullException() { // arrange NameString schemaName = "Foo"; var fieldReference = new FieldReference("A", "a"); // act Action action = () => StitchingBuilderExtensions .IgnoreField(null, schemaName, fieldReference); // assert Assert.Equal("builder", Assert.Throws <ArgumentNullException>(action).ParamName); }