コード例 #1
0
        public void AssertInvocationCountAutomaticExceptionGeneric()
        {
            Expect.Once.On(this.testInterfaceGeneric).EventAdd("MyEvent");
            var eventTester = new EventTester <EventArgs>(this.testInterfaceGeneric, "MyEvent", 1);

            this.mockery.VerifyAllExpectationsHaveBeenMet();

            Fire.On(this.testInterfaceGeneric).Event("MyEvent").With(null, EventArgs.Empty);
            Fire.On(this.testInterfaceGeneric).Event("MyEvent").With(null, EventArgs.Empty);

            Expect.Once.On(this.testInterfaceGeneric).EventRemove("MyEvent");

            Assert.Throws <EventTesterException>(
                () => eventTester.Dispose());

            this.mockery.VerifyAllExpectationsHaveBeenMet();
        }
コード例 #2
0
        public void AssertInvocationCountAutomaticExceptionGeneric()
        {
            Expect.Once.On(this.testInterfaceGeneric).EventAdd("MyEvent");
            var eventTester = new EventTester<EventArgs>(this.testInterfaceGeneric, "MyEvent", 1);

            this.mockery.VerifyAllExpectationsHaveBeenMet();

            Fire.On(this.testInterfaceGeneric).Event("MyEvent").With(null, EventArgs.Empty);
            Fire.On(this.testInterfaceGeneric).Event("MyEvent").With(null, EventArgs.Empty);

            Expect.Once.On(this.testInterfaceGeneric).EventRemove("MyEvent");

            Assert.Throws<EventTesterException>(
                () => eventTester.Dispose());

            this.mockery.VerifyAllExpectationsHaveBeenMet();
        }