public void set_GetKey() { ICallback callback = Substitute.For <ICallback>(); cache.GetKey = callback.GetKeyCallback; cache.GetKey(42); callback.Received().GetKeyCallback(42); }
public void ifPropertyTypeIs_invokes_method() { Accessor accessor = _expression.ToAccessor(); accessor.IfPropertyTypeIs <int>(_callback.Callback); _callback.Received().Callback(); accessor.IfPropertyTypeIs <PropertyHolder>(_uncalledCallback.Callback); _uncalledCallback.DidNotReceive().Callback(); }
public void set_OnAddition() { ICallback callback = Substitute.For <ICallback>(); cache["firstKey"] = 0; callback.DidNotReceive().OnAdditionCallback(42); cache.OnAddition = callback.OnAdditionCallback; cache[Key] = 42; callback.Received().OnAdditionCallback(42); }
public async Task WhenDroveCustomerToTrainStation_ShouldCallback() { // Arrange var @event = _fixture.Create <DroveCustomerToTrainStation>(); // Act await _sut.Handle(@event); // Assert await _callback .Received(1) .CallBack(@event.CabRideId); }
public async Task WhenDroveCustomerToTrainStation_ShouldInvokeCallback() { // Arrange var payload = _fixture.Create <DroveCustomerToTrainStation>(); // Act await _sut.Handle(payload); // Assert await _callback .Received(1) .CallBack(Arg.Is(payload.CabRideId)); }