Ejemplo n.º 1
0
        public async Task UpdateUserMessagesTask_UpdateUserCallsConverter_MessagesCorrect()
        {
            var testUser          = TestModelFactory.CreateUserModel();
            var testMessageModels = new List <MessageModel> {
                TestModelFactory.CreateMessageModel()
            };

            _fakeAppToDbModelConverter.Convert(Arg.Any <List <MessageModel> >()).Returns(new List <Message>());

            await _uut.UpdateUserMessagesTask(testMessageModels);

            _fakeAppToDbModelConverter.Received().Convert(Arg.Is <List <MessageModel> >(m => m == testMessageModels));
        }
Ejemplo n.º 2
0
        public async Task RegisterCarProfileTask(CarProfileModel CarProfile)
        {
            var possibleToRentDays = new List <PossibleToRentDayModel>();

            for (var i = CarProfile.StartLeaseTime; i < CarProfile.EndLeaseTime; i += TimeSpan.FromDays(1))
            {
                possibleToRentDays.Add(new PossibleToRentDayModel()
                {
                    CarProfile = CarProfile,
                    Date       = i,
                });
            }
            var carModel = _appToDbModelConverter.Convert(CarProfile);

            carModel.PossibleToRentDays = _appToDbModelConverter.Convert(possibleToRentDays);
            using (var db = _dbContextFactory.GetContext())
            {
                await db.AddCarProfile(carModel);
            }
        }