Exemplo n.º 1
0
        public void CreateNewInstanceTest2()
        {
            var versionUnderTest = _powerSHAPE.Version;

            // Create new instance
            var automation = new PSAutomation(InstanceReuse.CreateNewInstance,
                                              new Version(versionUnderTest.Major, versionUnderTest.Minor, 0),
                                              new Version(versionUnderTest.Major, versionUnderTest.Minor, 99),
                                              Modes.PShapeMode);

            Assert.IsNotNull(automation, "PowerSHAPE has not been started");
            Assert.Less(new Version(versionUnderTest.Major, versionUnderTest.Minor, 0),
                        automation.Version,
                        "PowerSHAPE version is incorrect");
            Assert.Greater(new Version(versionUnderTest.Major, versionUnderTest.Minor, 99),
                           automation.Version,
                           "PowerSHAPE version is incorrect");

            // Create second instance
            var automation2 = new PSAutomation(InstanceReuse.CreateNewInstance,
                                               new Version(versionUnderTest.Major, versionUnderTest.Minor, 0),
                                               new Version(versionUnderTest.Major, versionUnderTest.Minor, 99),
                                               Modes.PShapeMode);

            Assert.IsNotNull(automation2, "PowerSHAPE has not been started");
            Assert.Less(new Version(versionUnderTest.Major, versionUnderTest.Minor, 0),
                        automation2.Version,
                        "PowerSHAPE version is incorrect");
            Assert.Greater(new Version(versionUnderTest.Major, versionUnderTest.Minor, 99),
                           automation2.Version,
                           "PowerSHAPE version is incorrect");

            automation.Quit();
            automation2.Quit();
        }
Exemplo n.º 2
0
        public void CreateSingleInstanceTest()
        {
            // What version are we currently testing?
            var versionUnderTest = _powerSHAPE.Version;
            var psProcess        = Process.GetProcessById(_powerSHAPE.ProcessId);

            // Create new instance
            var automation = new PSAutomation(InstanceReuse.CreateSingleInstance,
                                              new Version(versionUnderTest.Major, versionUnderTest.Minor, 0),
                                              new Version(versionUnderTest.Major, versionUnderTest.Minor, 99),
                                              Modes.PShapeMode);

            // Check that the previous one exited
            var processExited = psProcess.HasExited;

            // Set to null incase the asserts fail
            _powerSHAPE = null;

            Assert.IsNotNull(automation, "PowerSHAPE has not been started");
            var startedVersion = automation.Version;

            automation.Quit();

            // Start the version under test again so that things carry on as before
            _powerSHAPE = new PSAutomation(InstanceReuse.CreateSingleInstance, versionUnderTest);

            Assert.Less(new Version(versionUnderTest.Major, versionUnderTest.Minor, 0),
                        startedVersion,
                        "PowerSHAPE version is incorrect");
            Assert.Greater(new Version(versionUnderTest.Major, versionUnderTest.Minor, 99),
                           startedVersion,
                           "PowerSHAPE version is incorrect");
            Assert.AreEqual(true, processExited);
        }
Exemplo n.º 3
0
        public void ProcessIdTest()
        {
            var singleInstance = new PSAutomation(InstanceReuse.CreateNewInstance);
            var newProcessId   = singleInstance.ProcessId;

            singleInstance.Quit();

            Assert.That(newProcessId, Is.Not.EqualTo(_powerSHAPE.ProcessId));
        }
Exemplo n.º 4
0
        // NOTE: This test should run when testing on your local machine; this was done because it was failing to run on our build server.
        public void CreateNewInstance_WhenUsing2018NotationWithoutSpecifyingMaximumVersion()
        {
            var versionUnderTest = _powerSHAPE.Version;
            var twenty18         = new PSAutomation(InstanceReuse.CreateNewInstance, new Version("2018.0.0"));

            Assert.That(twenty18.Version.Major, Is.EqualTo(18));
            twenty18.Quit();

            // Ensure that the version under test is properly registered as the current version so other tests carry on ok...
            var testVersion = new PSAutomation(InstanceReuse.CreateNewInstance, versionUnderTest);

            testVersion.Quit();
        }
Exemplo n.º 5
0
        // NOTE: This test should run when testing on your local machine; this was done because it was failing to run on our build server.
        public void CreateSingleInstance_WhenUsing18NotationWithoutSpecifyingMaximumVersion()
        {
            var versionUnderTest = _powerSHAPE.Version;

            // Create new instance
            var twenty18 = new PSAutomation(InstanceReuse.CreateSingleInstance, new Version("18.1.0"));

            Assert.That(twenty18.Version.Major, Is.EqualTo(18));
            twenty18.Quit();

            // Start the version under test again so that things carry on as before
            _powerSHAPE = new PSAutomation(InstanceReuse.CreateSingleInstance, versionUnderTest);
        }
Exemplo n.º 6
0
        // NOTE: This test should run when testing on your local machine; this was done because it was failing to run on our build server.
        public void UseExistingInstance_WhenUsing18NotationWithoutSpecifyingMaximumVersion()
        {
            var versionUnderTest = _powerSHAPE.Version;
            var twenty18         = new PSAutomation(InstanceReuse.UseExistingInstance, new Version("18.1.0"));

            Assert.That(twenty18.Version.Major, Is.EqualTo(18));
            twenty18.Quit();

            //// Ensure that the version under test is properly registered as the current version so other tests carry on ok...
            //var testVersion = new PSAutomation(InstanceReuse.CreateNewInstance, versionUnderTest);
            //testVersion.Quit();
            // Start the version under test again so that things carry on as before and avoid using the previous code
            // because it was causing the next test failure
            _powerSHAPE = new PSAutomation(InstanceReuse.CreateSingleInstance, versionUnderTest);
        }
Exemplo n.º 7
0
        public void MultipleVersionsTest_WhenUsing18Notation()
        {
            var versionUnderTest = _powerSHAPE.Version;
            var twenty17         = new PSAutomation(InstanceReuse.CreateNewInstance, new Version(17, 1, 0), new Version(17, 1, 99));

            Assert.That(twenty17.Version.Major, Is.EqualTo(17));
            twenty17.Quit();
            var twenty18 = new PSAutomation(InstanceReuse.CreateNewInstance, new Version(18, 1, 0), new Version(18, 1, 99));

            Assert.That(twenty18.Version.Major, Is.EqualTo(18));
            twenty18.Quit();

            // Ensure that the version under test is properly registered as the current version so other tests carry on ok...
            var testVersion = new PSAutomation(InstanceReuse.CreateNewInstance, versionUnderTest);

            testVersion.Quit();
        }
Exemplo n.º 8
0
        public void CreateNewInstanceTest()
        {
            var versionUnderTest = _powerSHAPE.Version;

            // Create new instance
            var automation = new PSAutomation(InstanceReuse.CreateNewInstance,
                                              new Version(versionUnderTest.Major, versionUnderTest.Minor, 0),
                                              new Version(versionUnderTest.Major, versionUnderTest.Minor, 99),
                                              Modes.PShapeMode);

            Assert.IsNotNull(automation, "PowerSHAPE has not been started");
            Assert.Less(new Version(versionUnderTest.Major, versionUnderTest.Minor, 0),
                        automation.Version,
                        "PowerSHAPE version is incorrect");
            Assert.Greater(new Version(versionUnderTest.Major, versionUnderTest.Minor, 99),
                           automation.Version,
                           "PowerSHAPE version is incorrect");
            Assert.AreNotEqual(0, automation.Windows, "No windows were opened");
            Assert.AreNotEqual(0, automation.Models, "No models were opened");
            automation.Quit();
        }