public void Execute_Abort() { IActionWrapperClass wrapper = new IActionWrapperClass(new BasicAction()); ActionData testData = new ActionData(); testData.Tag = "Execute_Abort.txt"; testData.DisplayName = "Execute_Abort.txt"; string file = CreateFile("Execute_Abort.txt"); testData.FileName = file; testData.Properties["DisplayName"] = "Execute_Abort.txt"; ActionPropertySet props = new ActionPropertySet(); testData.Properties[IActionWrapperClass.ABORT] = bool.FalseString; string output = wrapper.Execute(testData, props); Assert.IsTrue(!String.IsNullOrEmpty(output) && System.IO.File.Exists(output) , "Although abort property was present, the value was not true. Hence no exception expected."); testData.Properties[IActionWrapperClass.ABORT] = bool.TrueString; try { //execute testData.FileName = CreateFile("Execute_Abort.txt"); output = wrapper.Execute(testData, props); } catch (AbortActionException) { Assert.IsTrue(true, "Expecting to arrive here when abort property was added"); return; } Assert.Fail("Should have thrown an abort exception"); }
public void Execute() { //setup IActionWrapperClass wrapper = new IActionWrapperClass(new BasicAction()); ActionData testData = new ActionData(); //testData.Content = new MemoryStream(); testData.Tag = "Execute.txt"; testData.DisplayName = "Execute.txt"; string file = CreateFile("Execute.txt"); testData.FileName = file; testData.Properties["DisplayName"] = "Execute.txt"; ActionPropertySet props = new ActionPropertySet(); //execute string output = wrapper.Execute(testData, props); Assert.IsTrue(output == file, "Input file and output file should be the same."); Assert.IsTrue(!String.IsNullOrEmpty(output) && System.IO.File.Exists(output)); Assert.AreEqual(1, int.Parse(testData.Properties["ExecuteCalled"]), "Execute should be called only once"); }