Exemplo n.º 1
0
        public void ThrowIfNoStepInVeryStrictMode()
        {
            var eventMock = new EventMock <EventHandler>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.VeryStrict);
            var ex        = Assert.Throws <MockMissingException>(() => eventMock.Remove(_handler));

            Assert.Equal(MockType.EventRemove, ex.MemberType);
        }
Exemplo n.º 2
0
        public void DoNothingIfClearedInLenientMode()
        {
            var eventMock = new EventMock <EventHandler>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
            var nextStep  = NextStepFor(eventMock);

            eventMock.Clear();
            eventMock.Remove(_handler);
            Assert.Equal(0, nextStep.AddCount);
            Assert.Equal(0, nextStep.RemoveCount);
        }
Exemplo n.º 3
0
        public void ThrowIfClearedInVeryStrictMode()
        {
            var eventMock = new EventMock <EventHandler>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.VeryStrict);
            var nextStep  = NextStepFor(eventMock);

            eventMock.Clear();
            var ex = Assert.Throws <MockMissingException>(() => eventMock.Remove(_handler));

            Assert.Equal(MockType.EventRemove, ex.MemberType);
            Assert.Equal(0, nextStep.AddCount);
            Assert.Equal(0, nextStep.RemoveCount);
        }
Exemplo n.º 4
0
        public void SendMockInformationAndHandlerToStep()
        {
            var eventMock = new EventMock <EventHandler>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
            var nextStep  = NextStepFor(eventMock);

            eventMock.Remove(_handler);

            Assert.Equal(0, nextStep.AddCount);
            Assert.Equal(1, nextStep.RemoveCount);
            Assert.Same(eventMock, nextStep.LastRemoveMockInfo);
            Assert.Equal(_handler, nextStep.LastRemoveValue);
        }
Exemplo n.º 5
0
        public void DoNothingIfNoStepInLenientMode()
        {
            var eventMock = new EventMock <EventHandler>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);

            eventMock.Remove(_handler);
        }
Exemplo n.º 6
0
 public EventMockSetNextStepTests()
 {
     _eventMock = new EventMock <EventHandler>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
 }