Пример #1
0
        public void NewSoliutionTest()
        {
            Mock <IGraphicalUserInterface> _gui = new Mock <IGraphicalUserInterface>();

            _gui.SetupGet(x => x.MessageBoxShowWarningAskYN).Returns(() => (x, y) => true);
            int _eventCounter = 0;
            ISolutionConfigurationManagement _newSolution = null;

            SolutionConfigurationManagementRoot.DefaultInstance.AfterSolutionChange += (x, y) => { _eventCounter++; _newSolution = y.Solution; Assert.AreSame(x, SolutionConfigurationManagementRoot.DefaultInstance); };
            SolutionConfigurationManagementRoot _freshInstance = null;

            SolutionConfigurationManagementRoot.GetInstance(c => _freshInstance = c);
            ISolutionConfigurationManagement _instance = null;

            _freshInstance.AfterSolutionChange += (x, y) => _instance = y.Solution;
            SolutionConfigurationManagementRoot.NewSoliution(_gui.Object);
            Assert.IsNotNull(_instance);
            Assert.IsTrue(_instance.ChangesArePresent);
            Assert.IsFalse(string.IsNullOrEmpty(_instance.DefaultDirectory));
            Assert.AreEqual <string>(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), _instance.DefaultDirectory);
            Assert.AreEqual <string>("UAModelDesignerSolution", Path.GetFileName(_instance.DefaultFileName));
        }
Пример #2
0
 public void OnNew(IGraphicalUserInterface gui)
 {
     SolutionConfigurationManagementRoot.NewSoliution(gui);
 }