Ejemplo n.º 1
0
        public void Create_Returns_Secondary_View_For_Compound_Elements(Type elementType, Type expectedType)
        {
            //Arrange
            Guid typeId = ElementAttributeGrabber.GetTypeId(elementType);

            // mock up the element definition so it returns the correct type id
            var mockDef = new Mock<IElementDefinition>();
            mockDef.Setup(m => m.ElementTypeId).Returns(typeId);

            var ctor = elementType.GetConstructor(new Type[] { typeof(Guid), typeof(IElementDefinition)});
            var el = ctor.Invoke(new object[] {typeId, mockDef.Object}) as ICompoundElement;

            var svf = new SecondaryViewFactory();

            //Act
            ISecondaryView view = svf.Create(el);

            //Assert
            Assert.NotNull(view);

            ISecondaryFxView fxView = view.SecondaryFxView;

            Assert.NotNull(fxView);
            Assert.IsType(expectedType, fxView);
        }
Ejemplo n.º 2
0
        public void Create_Throws_Ex_When_Null_Passed_In()
        {
            //Arrange
            var svf = new SecondaryViewFactory();
            ISecondaryView view = null;

            //Act, Assert
            var ex = Assert.Throws<NotImplementedException>(() => view = svf.Create(null));
        }