예제 #1
0
        public void set_GetKey()
        {
            ICallback callback = Substitute.For <ICallback>();

            cache.GetKey = callback.GetKeyCallback;
            cache.GetKey(42);
            callback.Received().GetKeyCallback(42);
        }
예제 #2
0
        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();
        }
예제 #3
0
        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);
        }
예제 #4
0
        public async Task WhenDroveCustomerToTrainStation_ShouldCallback()
        {
            // Arrange
            var @event = _fixture.Create <DroveCustomerToTrainStation>();

            // Act
            await _sut.Handle(@event);

            // Assert
            await _callback
            .Received(1)
            .CallBack(@event.CabRideId);
        }
예제 #5
0
        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));
        }