public void ExecutesAnonymousBehavior() { var called = false; var behavior = new AnonymousMockBehavior((m, i, n) => { called = true; return(i.CreateValueReturn(null)); }, "test"); var mock = new FakeMock(); behavior.Execute(mock.Mock, new MethodInvocation(mock, typeof(object).GetMethod(nameof(object.ToString))), () => null); Assert.True(called); }
public void MockAsT() { var target = new FakeMock(); var mock = target.Mock; var generic = target.AsMock(); Assert.Equal(generic.Behaviors, mock.Behaviors); Assert.Same(generic.Object, mock.Object); Assert.Same(((IMock)generic).Object, mock.Object); Assert.Same(generic.Invocations, mock.Invocations); Assert.Equal(generic.Setups, mock.Setups); Assert.Same(generic.State, mock.State); }