コード例 #1
0
        private void AcceptButton_Click(object sender, System.EventArgs e)
        {
            EditDiagramCommand command = new EditDiagramCommand(NameTextBox.Text, newBackgroundColor, newForegroundColor, newClassColor, TargetDrawing);

            _invoker.EnqueueCommandForExecution(command);
            this.Hide();
        }
コード例 #2
0
        public void EditDiagramTest()
        {
            _testInvoker.Start();
            Color  newBackgroundColor   = Color.Aqua;
            Color  newForegroundColor   = Color.Beige;
            string newDrawingName       = "New Name";
            Color  newDefaultClassColor = Color.Purple;

            EditDiagramCommand cmd = new EditDiagramCommand(newDrawingName, newBackgroundColor, newForegroundColor, newDefaultClassColor, testDrawing);

            _testInvoker.EnqueueCommandForExecution(cmd);
            System.Threading.Thread.Sleep(1000);

            Assert.AreEqual(newDrawingName, testDrawing.DrawingName);
            Assert.AreEqual(newBackgroundColor, testDrawing.BackGroundColor);
            Assert.AreEqual(newForegroundColor, testDrawing.ForeGroundColor);
            Assert.AreEqual(newDefaultClassColor, testDrawing.DefaultClassColor);
        }
コード例 #3
0
        public void NewDiagramTest() //tests the creation of a new drawing.
        {
            _testInvoker.Start();
            Color  newBackgroundColor   = Color.Aqua;
            Color  newForegroundColor   = Color.Beige;
            string newDrawingName       = "New Name";
            Color  newDefaultClassColor = Color.Purple;

            EditDiagramCommand cmd = new EditDiagramCommand(newDrawingName, newBackgroundColor, newForegroundColor, newDefaultClassColor, testDrawing);

            _testInvoker.EnqueueCommandForExecution(cmd);
            System.Threading.Thread.Sleep(1000);

            NewDrawingCommand newCommand = new NewDrawingCommand(testDrawing);

            _testInvoker.EnqueueCommandForExecution(newCommand);
            System.Threading.Thread.Sleep(1000);


            Assert.AreEqual("New Drawing", testDrawing.DrawingName);
            Assert.AreEqual(Color.White, testDrawing.BackGroundColor);
            Assert.AreEqual(Color.Black, testDrawing.ForeGroundColor);
            Assert.AreEqual(Color.LightBlue, testDrawing.DefaultClassColor);
        }