public CreateContactViewModel(CreateContactQueryResult createContact, IValidationService validationService)
 {
     this.command = createContact.Command;
     this.Counties = createContact.Counties;
     this.Countries = createContact.Countries;
     this.validationService = validationService;
 }
        public WhenUserRequestsCreateContactForm()
        {
            var countyRepository = Mock.Of<ICountyRepository>();
            var countryRepository = Mock.Of<ICountryRepository>();

            var queryInvoker = new QueryInvoker(new ContactService(countyRepository,
                countryRepository,
                null,
                new ValidationService(),
                new ContactAdministrationService(countyRepository,
                    countryRepository,
                    null)));

            Mock.Get(countyRepository).Setup(q => q.GetAll()).Returns(_counties);
            Mock.Get(countryRepository).Setup(q => q.GetAll()).Returns(_countries);

            _createContactResult = queryInvoker.Query<CreateContactQueryResult>();
        }
        //private Contact _contactCreated;
        public WhenUserRequestsToSaveAnInvalidContact()
        {
            _contactRepository = Mock.Of<IContactRepository>();
            //Mock.Get(_contactRepository)
            //    .Setup(q => q.Save(It.IsAny<Contact>()))
            //    .Callback<Contact>(q => _contactCreated = q);

            var countyRepository = Mock.Of<ICountyRepository>();
            Mock.Get(countyRepository)
                .Setup(q => q.GetById(1))
                .Returns(new County(1, "Merseyside"));

            var countryRepository = Mock.Of<ICountryRepository>();
            Mock.Get(countryRepository)
                .Setup(q => q.GetById(1))
                .Returns(new Country(1, "UK"));

            var commandInvoker = new CommandInvoker(new ContactService(countyRepository,
                countryRepository,
                _contactRepository,
                new ValidationService(),
                new ContactAdministrationService(countyRepository,
                    countryRepository,
                    _contactRepository)));

            Mock.Get(countyRepository).Setup(q => q.GetAll()).Returns(_counties);
            Mock.Get(countryRepository).Setup(q => q.GetAll()).Returns(_countries);

            _createContactCommand = new CreateContactCommand
            {
                FirstName = "",
                Surname = "",
                Address1 = "Address 1",
                Address2 = "Address 2",
                CountyId = 1,
                CountryId = 1,
            };
            _createContactResult =
                commandInvoker.Execute<CreateContactCommand, CreateContactQueryResult>(_createContactCommand);
        }