Exemplo n.º 1
0
        public void IgnoreRootTypes_BuilderIsNull_ArgumentNullException()
        {
            // arrange
            // act
            Action action = () => StitchingBuilderExtensions
                            .IgnoreRootTypes(null);

            // assert
            Assert.Equal("builder",
                         Assert.Throws <ArgumentNullException>(action).ParamName);
        }
Exemplo n.º 2
0
        public void IgnoreRootTypes_2_NameIsEmpty_ArgumentException()
        {
            // arrange
            IDocumentRewriter docRewriter = null;
            var mock = new Mock <IStitchingBuilder>();

            mock.Setup(t => t.AddDocumentRewriter(
                           It.IsAny <IDocumentRewriter>()))
            .Returns(new Func <IDocumentRewriter, IStitchingBuilder>(t =>
            {
                docRewriter = t;
                return(mock.Object);
            }));

            // act
            Action action = () => StitchingBuilderExtensions
                            .IgnoreRootTypes(mock.Object, null);

            // assert
            Assert.Equal("schemaName",
                         Assert.Throws <ArgumentException>(action).ParamName);
        }
Exemplo n.º 3
0
        public void IgnoreRootTypes()
        {
            // arrange
            IDocumentRewriter docRewriter = null;
            var mock = new Mock <IStitchingBuilder>();

            mock.Setup(t => t.AddDocumentRewriter(
                           It.IsAny <IDocumentRewriter>()))
            .Returns(new Func <IDocumentRewriter, IStitchingBuilder>(t =>
            {
                docRewriter = t;
                return(mock.Object);
            }));

            // act
            StitchingBuilderExtensions.IgnoreRootTypes(mock.Object);

            // assert
            RemoveRootTypeRewriter rewriter =
                Assert.IsType <RemoveRootTypeRewriter>(docRewriter);

            Assert.Null(rewriter.SchemaName);
        }