示例#1
0
        public void Given_has_contact_detail_found_When_UpdateContactDetails_Then_calls_correct_method()
        {
            // Given
            var contactDetailsParameters = new AddUpdateEmployeeContactDetailsParameters
            {
                Id = 1L
            };

            var userForAuditing = new UserForAuditing();
            var target = new Employee();

            var employeeContactDetail = new Mock<EmployeeContactDetail>();
            employeeContactDetail
                .Setup(x => x.Id)
                .Returns(1L);

            employeeContactDetail
                .Setup(x => x.Update(contactDetailsParameters, userForAuditing, target));

            target.ContactDetails.Add(employeeContactDetail.Object);

            // When
            target.UpdateContactDetails(contactDetailsParameters, userForAuditing);

            // Then
            employeeContactDetail.Verify(x => x.Update(contactDetailsParameters, userForAuditing, target));
        }