public StudioValidatorTests() { _postalCodeValidator = new Mock <IPostalCodeValidator>(); _studioRepository = new Mock <IStudioRepository>(); _studioValidator = new StudioValidator(_postalCodeValidator.Object, _studioRepository.Object); }
public void Update(string name, string friendlyUrl, string postalCode, IStudioValidator studioValidator) { AsyncHelper.RunSync(() => studioValidator.ValidateAsync(this.Id, name, friendlyUrl, postalCode)); this.Name = name; this.FriendlyUrl = friendlyUrl; this.PostalCode = postalCode; }
public StudioService( IStudioValidator studioUrlValidator, IStudioRepository studioRepository, IPostalCodeRepository postalCodeRepository, IUserRepository userRepository, IMapper mapper) { _studioUrlValidator = studioUrlValidator; _studioRepository = studioRepository; _postalCodeRepository = postalCodeRepository; _userRepository = userRepository; _mapper = mapper; }
public static Studio Create( string name, string friendlyUrl, string postalCode, Guid ownerUserId, IStudioValidator studioValidator) { AsyncHelper.RunSync(() => studioValidator.ValidateAsync(null, name, friendlyUrl, postalCode)); var result = new Studio { Id = Guid.NewGuid(), Name = name, FriendlyUrl = friendlyUrl, Rooms = new List <Room>(), OwnerUserId = ownerUserId, PostalCode = postalCode }; return(result); throw new InvalidOperationException(); }