public void FailIfCalledNotSameNumberOfTimes() { var fakeComponent = Moq.Mock.Of <IComponent>(); var service = new HooksService(); service.UseState(0, fakeComponent); service.UseState("Foo", fakeComponent); service.ComponentRendered(fakeComponent); service.UseState(0, fakeComponent); service.UseState("Foo", fakeComponent); service.Invoking(s => s.UseState(99, fakeComponent)) .Should().Throw <ArgumentOutOfRangeException>(); }
public void FailIfCalledNotInSameOrder() { var fakeComponent = Moq.Mock.Of <IComponent>(); var service = new HooksService(); service.UseState(0, fakeComponent); service.UseState("Foo", fakeComponent); service.UseState(99, fakeComponent); service.ComponentRendered(fakeComponent); service.UseState(0, fakeComponent); service.Invoking(s => s.UseState(99, fakeComponent)) .Should().Throw <InvalidCastException>(); }