public ElementViewModelFactory(ElementFactoryBase elementFactory, LineElementViewModel.Factory lineElementFactory, LabelElementViewModel.Factory labelElementFactory, ContainerElementViewModel.Factory containerElementFactory)
 {
     this.elementFactory = elementFactory;
     this.lineElementFactory = lineElementFactory;
     this.labelElementFactory = labelElementFactory;
     this.containerElementFactory = containerElementFactory;
 }
        public void Add_Element_AddsToScreen()
        {
            var tools = new Mock<ToolViewModelBase>();
            var viewModel = new ScreenEditorViewModel(new[] { tools.Object });

            var element = new LineElementViewModel();
            viewModel.Add(element);

            Assert.Equal(1, viewModel.Elements.Count);
            Assert.Equal(element, viewModel.Elements[0]);
        }
        public void AddToolCommand_WhenExecuted_AddsLineElementToScreen()
        {
            var fakeScreenEditor = new Mock<ScreenEditorViewModelBase>();
            var fakeElementFactory = new Mock<ElementViewModelFactoryBase>();

            var lineElement = new LineElementViewModel();
            fakeElementFactory.Setup(q => q.CreateLine()).Returns(lineElement);

            var tool = new LineToolViewModel(fakeElementFactory.Object);
            tool.Initialise(fakeScreenEditor.Object);
            tool.AddTool.Execute(null);

            fakeScreenEditor.Verify(q => q.Add(lineElement));
        }