Inheritance: System.Dynamic.DynamicObject, IShapeFactory
 public OrchardServicesMock(MockBehavior mockBehavior)
 {
     ContentManagerMock = new ContentManagerMock(mockBehavior);
     TransactionManagerMock = new TransactionManagerMock(mockBehavior);
     AuthorizerMock = new AuthorizerMock(mockBehavior);
     NotifierMock = new NotifierMock(mockBehavior);
     WorkContextMock = new WorkContextMock(mockBehavior);
     New = new ShapeFactoryMock();
 }
        public static ShapeMock BuildShapeMock(this ContentShapeResult shapeResult)
        {
            const BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic;
            FieldInfo shapeBuilderField = typeof(ContentShapeResult).GetField("_shapeBuilder", bindingFlags);
            var builder = (Func<BuildShapeContext, dynamic>)shapeBuilderField.GetValue(shapeResult);

            var content = new Mock<IContent>();
            content.Setup(x => x.ContentItem).Returns(new ContentItem { ContentType = "Mock" });

            var shape = new Mock<IShape>();
            var shapeFactoryMock = new ShapeFactoryMock();
            var ctx = new Mock<BuildShapeContext>(shape.Object, content.Object, string.Empty, shapeFactoryMock).Object;

            var result = (ShapeMock)builder(ctx);

            if (result != null)
            {
                result.Type = shapeResult.GetShapeType();
            }

            return result;
        }
Exemplo n.º 3
0
 protected ShapeTestFixture()
 {
     ShapeFactory = new ShapeFactoryMock();
 }
Exemplo n.º 4
0
 public virtual void Setup()
 {
     ShapeFactory = new ShapeFactoryMock();
 }