From 4eafac6b94cd32dcb7db0c6255bf66d7c8cc1d03 Mon Sep 17 00:00:00 2001
From: Harry Jeffery <henry.jeffery@stfc.ac.uk>
Date: Mon, 30 Mar 2015 14:13:38 +0100
Subject: [PATCH] Refs #11355 Transfer 4th bin param test

---
 .../Framework/MDAlgorithms/test/CutMDTest.h   | 28 +++++++++++++++++++
 .../test/python/mantid/api/CutMDTest.py       |  6 ----
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h
index e26585b766f..0cbba165894 100644
--- a/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h
+++ b/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h
@@ -63,6 +63,34 @@ public:
     TS_ASSERT_THROWS_NOTHING(alg.initialize())
     TS_ASSERT(alg.isInitialized())
   }
+
+  void test_exec_throws_if_giving_4th_binning_param_when_workspace_is_3d() {
+    const std::string wsName = "__CutMDTest_4thbinon3dthrows";
+
+    FrameworkManager::Instance().exec("CreateMDWorkspace", 10,
+        "OutputWorkspace", wsName.c_str(),
+        "Dimensions", "3",
+        "Extents", "-10,10,-10,10,-10,10",
+        "Names", "H,K,L",
+        "Units", "U,U,U");
+
+    FrameworkManager::Instance().exec("SetSpecialCoordinates", 4,
+        "InputWorkspace", wsName.c_str(),
+        "SpecialCoordinates", "HKL");
+
+    auto algCutMD = FrameworkManager::Instance().createAlgorithm("CutMD");
+    algCutMD->initialize();
+    algCutMD->setRethrows(true);
+    algCutMD->setProperty("InputWorkspace", wsName);
+    algCutMD->setProperty("OutputWorkspace", wsName);
+    algCutMD->setProperty("P1Bin", "0.1");
+    algCutMD->setProperty("P2Bin", "0.1");
+    algCutMD->setProperty("P3Bin", "0.1");
+    algCutMD->setProperty("P4Bin", "0.1");
+    TS_ASSERT_THROWS(algCutMD->execute(), std::runtime_error)
+
+    AnalysisDataService::Instance().remove(wsName);
+  }
 };
 
 #endif /* MANTID_MDALGORITHMS_CUTMDTEST_H_ */
diff --git a/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py b/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py
index 203ed1ecb0b..d4553be2dc6 100644
--- a/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py
+++ b/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py
@@ -22,12 +22,6 @@ class CutMDTest(unittest.TestCase):
     def tearDown(self):
         DeleteWorkspace(self.__in_md )
 
-    def test_exec_throws_if_giving_4th_binning_parameter_when_workspace_is_3D(self):
-        test_md = CreateMDWorkspace(Dimensions=3, Extents=[-10,10,-10,10,-10,10], Names="H,K,L", Units="U,U,U")
-        # Explicitly set the coordinate system to lab Q.
-        SetSpecialCoordinates(InputWorkspace=test_md, SpecialCoordinates='HKL')
-        self.assertRaises(RuntimeError, CutMD, InputWorkspace=test_md, OutputWorkspace="out_ws", P1Bin=[0.1], P2Bin=[0.1], P3Bin=[0.1], P4Bin=[0.1])
-        
     def test_slice_to_original(self):
         out_md = CutMD(self.__in_md, P1Bin=[0.1], P2Bin=[0.1], P3Bin=[0.1], CheckAxes=False)
         self.assertTrue(isinstance(out_md, IMDEventWorkspace), "Should default to producing an IMDEventWorkspace.")
-- 
GitLab