示例#1
0
        public LastActionKeys GetLastActionIds(long userId)
        {
            User           User           = _repository.Get(userId);
            LastActionKeys LastActionKeys = new LastActionKeys()
            {
                LastBookingId     = User.LastBookingId,
                LastRideOfferedId = User.LastOfferRideId
            };

            return(LastActionKeys);
        }
        public void GetLastActionIds_ShouldWork()
        {
            User SampleUser = UserTestingData.GetSampleUser();

            using (var mock = AutoMock.GetStrict())
            {
                var TestService = mock.Create <UserAuthenticationServices>();

                mock.Mock <IRepositoryManager <User> >().Setup(x => x.Get(19)).Returns(SampleUser).Verifiable();

                LastActionKeys ActualKeys = TestService.GetLastActionIds(19);

                mock.Mock <IRepositoryManager <User> >().Verify(x => x.Get(19), Times.Exactly(1));

                Assert.Equal(15, ActualKeys.LastRideOfferedId);
            }
        }