Beispiel #1
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);
        }