Esempio n. 1
0
        public ActionResult Index(TimeEntry timeEntry)
        {
            TimeEntryFormViewModel viewModel =
                _timeEntryManagementService.CreateFormViewModelFor(timeEntry, _authenticationProvider.GetLoggedInUser());

            if (!viewModel.TimeEntry.SystemId.HasValue)
            {
                viewModel.RecentRequests.Clear();
            }

            return(View(viewModel));
        }
Esempio n. 2
0
        public void CanCreateFormViewModelForTimeEntry()
        {
            // Establish Context
            var viewModelToExpect = new TimeEntryFormViewModel();

            _personManagementService.Expect(x => x.GetByUserName(Arg <string> .Is.Anything)).Return(
                PersonInstanceFactory.CreateValidTransientPerson());

            TimeEntry timeEntry =
                TimeEntryInstanceFactory.CreateValidTransientTimeEntry();

            _timeEntryRepository.Expect(r => r.Get(Arg <int> .Is.Anything))
            .Return(timeEntry);

            // Act
            TimeEntryFormViewModel viewModelRetrieved =
                _timeEntryManagementService.CreateFormViewModelFor(1, "testuser");

            // Assert
            viewModelRetrieved.ShouldNotBeNull();
            viewModelRetrieved.TimeEntry.ShouldNotBeNull();
            viewModelRetrieved.TimeEntry.ShouldEqual(timeEntry);
        }