本文整理汇总了C#中TestEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# TestEventArgs类的具体用法?C# TestEventArgs怎么用?C# TestEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestEventArgs类属于命名空间,在下文中一共展示了TestEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Event_Should_Be_Routed_To_Device_Target
public void Event_Should_Be_Routed_To_Device_Target()
{
InputElement element = new InputElement();
TestEventArgs e = new TestEventArgs(element);
e.RoutedEvent = InputElement.RawEvent;
InputManager.Current.ProcessInput(e);
Assert.IsTrue(element.RawEventRaised);
}
示例2: TestAsyncEvents
public void TestAsyncEvents() {
var evtSource = new AsyncEventSource();
evtSource.TestEvent += AsyncEventsTest_AsyncHandler;
evtSource.TestEvent += AsyncEventsTest_SyncHandler;
var args = new TestEventArgs() { Value = 2 }; // incr value; our counter should be incremented twice by 2 - in two event handlers
_counter = 0;
AsyncHelper.RunSync(() => evtSource.RaiseEvent(args));
// now _counter should be 4
Assert.AreEqual(4, _counter, "Expected _counter set to 4");
}//test method
示例3: OnCompleteTestCase
private void OnCompleteTestCase(object src, TestEventArgs args)
{
if (args.TestStatus == TestEventArgs.Status.Fail)
{
string msg = string.Format("Failed in Test Dll {0} on Test Case {1} with the error {2}", args.DLL, args.CurrentRun, args.TestCase.ErrorSolution);
Assert.IsTrue(false, msg);
}
else
Assert.IsTrue(true);
}
示例4: Event_Should_Not_Be_Routed_If_Cancelled
public void Event_Should_Not_Be_Routed_If_Cancelled()
{
PreProcessInputEventHandler preProcess = (sender, ev) =>
{
ev.Cancel();
};
InputElement element = new InputElement();
TestEventArgs e = new TestEventArgs(element);
e.RoutedEvent = InputElement.RawEvent;
InputManager.Current.PreProcessInput += preProcess;
InputManager.Current.ProcessInput(e);
InputManager.Current.PreProcessInput -= preProcess;
Assert.IsFalse(element.RawEventRaised);
}
示例5: _test_OnTestFinished
void _test_OnTestFinished(object sender, TestEventArgs args)
{
if (InvokeRequired)
Invoke(new TestCompletedEvent(_test_OnTestFinished), sender, args);
else
{
_grid.Rows[_grid.Rows.Count - 1].SetValues(args.TestName, args.Result, args.Duration, (args.Exception == null) ? args.Message : args.Exception.Message);
if (args.Result == TestResultEnum.Failed)
{
_grid.Rows[_grid.Rows.Count - 1].Cells[1].Style.BackColor = Color.Red;
}
else if (args.Result == TestResultEnum.Inconclusive)
{
_grid.Rows[_grid.Rows.Count - 1].Cells[1].Style.BackColor = Color.LightBlue;
}
//_grid.Rows[_grid.Rows.Count - 1].Height = _grid.Rows[_grid.Rows.Count - 1].GetPreferredHeight(_grid.Rows.Count - 1, DataGridViewAutoSizeRowMode.AllCells, true);
}
}
示例6: PreNotifyInput_Should_Be_Called
public void PreNotifyInput_Should_Be_Called()
{
bool notified = false;
NotifyInputEventHandler preNotify = (sender, ev) =>
{
notified = true;
};
InputElement element = new InputElement();
TestEventArgs e = new TestEventArgs(element);
e.RoutedEvent = InputElement.RawEvent;
InputManager.Current.PreNotifyInput += preNotify;
InputManager.Current.ProcessInput(e);
InputManager.Current.PreNotifyInput -= preNotify;
Assert.IsTrue(notified);
}
示例7: event_passes_correct_arguments
public void event_passes_correct_arguments()
{
var expectedString = "test";
var actualString = string.Empty;
var testEventArgs = new TestEventArgs();
testEventArgs.TestString = expectedString;
var rootState = new StateMachineBuilder()
.State<TestState>("foo")
.Event<TestEventArgs>("newEvent", (state, eventArgs) => actualString = eventArgs.TestString)
.End()
.Build();
rootState.ChangeState("foo");
rootState.TriggerEvent("newEvent", testEventArgs);
Assert.Equal(expectedString, actualString);
}
示例8: OnRunStarting
private void OnRunStarting( object sender, TestEventArgs e )
{
suiteName.Text = e.Name;
EnableRunCommand( false );
EnableStopCommand( true );
runCount.Text = "";
}
示例9: OnTestChanged
/// <summary>
/// The current test suite has changed in some way,
/// so update the info in the UI and clear the
/// test results, since they are no longer valid.
/// </summary>
private void OnTestChanged( object sender, TestEventArgs e )
{
SetTitleBar(TestProject.Name);
if ( longOpDisplay != null )
{
longOpDisplay.Dispose();
longOpDisplay = null;
}
if (userSettings.GetSetting("Options.TestLoader.ClearResultsOnReload", false))
runCount.Text = null;
EnableRunCommand( true );
}
示例10: OnTestLoaded
/// <summary>
/// A test suite has been loaded, so update
/// recent assemblies and display the tests in the UI
/// </summary>
private void OnTestLoaded( object sender, TestEventArgs e )
{
if ( longOpDisplay != null )
{
longOpDisplay.Dispose();
longOpDisplay = null;
}
EnableRunCommand( true );
if ( TestLoader.TestCount == 0 )
{
foreach( TestAssemblyInfo info in TestLoader.AssemblyInfo )
if ( info.TestFrameworks.Count > 0 ) return;
MessageDisplay.Error("This assembly was not built with any known testing framework.");
}
}
示例11: OnTestUnloadStarting
private void OnTestUnloadStarting( object sender, TestEventArgs e )
{
EnableRunCommand( false );
}
示例12: OnTestProjectUnloaded
private void OnTestProjectUnloaded( object sender, TestEventArgs e )
{
SetTitleBar( null );
projectMenu.Visible = false;
runCount.Text = "";
}
示例13: OnTestProjectLoaded
private void OnTestProjectLoaded( object sender, TestEventArgs e )
{
string projectPath = e.Name;
SetTitleBar( projectPath );
projectMenu.Visible = true;
runCount.Text = "";
// If this is an NUnit project, set up watcher
if (NUnitProject.IsNUnitProjectFile(projectPath) && File.Exists(projectPath))
presenter.WatchProject(projectPath);
}
示例14: FireEventWithMultipleHandlersDoesNotContinueAfterFirstHandlerTest
public void FireEventWithMultipleHandlersDoesNotContinueAfterFirstHandlerTest()
{
string lastEventHandler = String.Empty;
// Arrange
eventUnderTest.EventSinks += ( sender, args ) =>
{
lastEventHandler = "EventHandlerOne";
args.Continue = false;
};
eventUnderTest.EventSinks += ( sender, args ) =>
{
lastEventHandler = "EventHandlerTwo";
args.Continue = true;
};
eventUnderTest.EventSinks += ( sender, args ) =>
{
lastEventHandler = "EventHandlerThree";
args.Continue = true;
};
var argsUnderTest = new TestEventArgs()
{
Continue = true
};
// Act
eventUnderTest.Fire( this, argsUnderTest, ( args ) => args.Continue == true );
// Assert
Assert.IsTrue( argsUnderTest.Continue == false && lastEventHandler == "EventHandlerOne", "{0} returned {1}", lastEventHandler, argsUnderTest.Continue );
}
示例15: FireEventWithMultipleHandlersTest
public void FireEventWithMultipleHandlersTest()
{
// Arrange
eventUnderTest.EventSinks += ( sender, args ) =>
{
args.Continue = true;
};
eventUnderTest.EventSinks += ( sender, args ) =>
{
args.Continue = true;
};
eventUnderTest.EventSinks += ( sender, args ) =>
{
args.Continue = true;
};
var argsUnderTest = new TestEventArgs()
{
Continue = true
};
// Act
eventUnderTest.Fire( this, argsUnderTest, ( args ) => args.Continue == true );
// Assert
Assert.IsTrue( argsUnderTest.Continue );
}