コード例 #1
0
        public void CanCreateFormViewModel()
        {
            // Establish Context
            var viewModelToExpect = new PersonFormViewModel();

            // Act
            PersonFormViewModel viewModelRetrieved =
                _personManagementService.CreateFormViewModel();

            // Assert
            viewModelRetrieved.ShouldNotBeNull();
            viewModelRetrieved.Person.ShouldBeNull();
        }
コード例 #2
0
        public void CanCreateFormViewModelForPerson()
        {
            // Establish Context
            var viewModelToExpect = new PersonFormViewModel();

            Person person =
                PersonInstanceFactory.CreateValidTransientPerson();

            _personRepository.Expect(r => r.Get(1))
            .Return(person);

            // Act
            PersonFormViewModel viewModelRetrieved =
                _personManagementService.CreateFormViewModelFor(1);

            // Assert
            viewModelRetrieved.ShouldNotBeNull();
            viewModelRetrieved.Person.ShouldNotBeNull();
            viewModelRetrieved.Person.ShouldEqual(person);
        }