public void DisposeTriggerWhenDisposed () { DynamicMock mock = new DynamicMock(typeof(ITrigger)); ITrigger trigger = (ITrigger) mock.Object; mock.Expect("Dispose"); AggregatedDeployEventDispatcher dispatcher = new AggregatedDeployEventDispatcher(trigger); dispatcher.Dispose(); mock.Verify(); }
public void DisposeDispatcherOnDispose () { DynamicMock mock = new DynamicMock (typeof (IDeployEventDispatcher)); IDeployEventDispatcher dispatcher = (IDeployEventDispatcher) mock.Object; mock.Expect ("Dispose"); IDeployLocation location = new FileSystemDeployLocation (dispatcher, deployPath); location.Dispose (); mock.Verify (); }
public void AdvisedSupportListenerMethodsAreCalledAppropriately() { IDynamicMock mock = new DynamicMock(typeof(IAdvisedSupportListener)); IAdvisedSupportListener listener = (IAdvisedSupportListener)mock.Object; mock.Expect("Activated"); mock.Expect("AdviceChanged"); mock.Expect("InterfacesChanged"); ProxyFactory factory = new ProxyFactory(new TestObject()); factory.AddListener(listener); // must fire the Activated callback... factory.GetProxy(); // must fire the AdviceChanged callback... factory.AddAdvice(new NopInterceptor()); // must fire the InterfacesChanged callback... factory.AddInterface(typeof(ISerializable)); mock.Verify(); }