Пример #1
0
        public void ViewDataTest_RecreateView_CloneWithoutChildren()
        {
            // Arrange
            cs_timed_silver.Properties.Settings.Default.AutoOpenLastFile = "No";
            var mf = new MainForm();

            mf.OnLoadCreateBasicViewDataWithView = false;
            mf.OnLoadUpdateViewType = false;

            mf.Show();

            Application.DoEvents();

            var vdParent = new ViewData(mf.MyDataFile)
            {
                ViewType = ViewDataType.Splitter
            };

            var vd = new ViewData(mf.MyDataFile)
            {
                Orientation    = Orientation.Horizontal,
                ParentViewData = vdParent,
                ViewType       = ViewDataType.List,
                ZoomPercent    = 170
            };

            vd.RecreateView(mf);

            ViewData vd2 = vd.CloneWithoutChildren();

            vd2.RecreateView(mf);

            // Act
            Application.DoEvents();

            // Assert
            Assert.AreEqual(Orientation.Horizontal, vd2.Orientation);
            Assert.AreEqual(vdParent, vd2.ParentViewData);
            Assert.AreEqual(vd.View.GetType(), vd2.View.GetType());
            Assert.AreEqual(ViewDataType.List, vd2.ViewType);
            Assert.AreEqual(170, vd2.ZoomPercent);
            Assert.AreNotSame(vd.View, vd2.View, "View passed with CloneWithoutChildren method different than the new view created at that moment.");
        }