public void TextMyMock () { Jockey jockey = new Jockey (); IDataService mockData = jockey.Mock<IDataService> (); Expect.When (mockData) .CallsMethod ("returnDexter") .ThatItReturns ("CSI"); Assert.AreEqual ("CSI", mockData.returnDexter ()); }
public void TextMyMockEvent () { Jockey jockey = new Jockey (); IEventsTest myMockEvents = jockey.Mock<IEventsTest> (); myMockEvents.TestEvent += MySubscriber; Expect.When (myMockEvents) .CallsMethod ("ExecuteWithSideEffect") .ThatItRaises ("TestEvent", myMockEvents, new EventArgs ()); myMockEvents.ExecuteWithSideEffect (); Assert.IsTrue (eventFlag); Jockey myJockey = new Jockey (); IDataService myMockService = myJockey.Mock<IDataService> (); Expect.When (myMockService) .CallsProperty ("Name") .ThatItReturns ("My Product Name"); Assert.IsNotNull (myMockService); Assert.AreEqual ("My Product Name", myMockService.Name); }