public void ThrowArgumentNullExceptionWithCorrectMessage_WhenIDisposableUnitOfWorkFactoryParameterIsNull() { var asyncRepository = new Mock <IAsyncRepository <IDbModel> >(); IDisposableUnitOfWorkFactory unitOfWorkFactory = null; Assert.That( () => new GenericAsyncService <IDbModel>(asyncRepository.Object, unitOfWorkFactory), Throws.InstanceOf <ArgumentNullException>().With.Message.Contains(nameof(unitOfWorkFactory))); }
public UsersAsyncService(IUsersAsyncRepository asyncRepository, IDisposableUnitOfWorkFactory unitOfWorkFactory, IFileDownloadProvider fileDownloadProvider, IProfilePictureFactory profilePictureFactory, IAddressFactory addressFactory) : base(asyncRepository, unitOfWorkFactory) { Guard.WhenArgument(asyncRepository, nameof(IUsersAsyncRepository)).IsNull().Throw(); Guard.WhenArgument(fileDownloadProvider, nameof(IFileDownloadProvider)).IsNull().Throw(); Guard.WhenArgument(profilePictureFactory, nameof(IProfilePictureFactory)).IsNull().Throw(); Guard.WhenArgument(addressFactory, nameof(IAddressFactory)).IsNull().Throw(); this.asyncRepository = asyncRepository; this.fileDownloadProvider = fileDownloadProvider; this.profilePictureFactory = profilePictureFactory; this.addressFactory = addressFactory; }
public GenericAsyncService(IAsyncRepository <T> asyncRepository, IDisposableUnitOfWorkFactory unitOfWorkFactory) { if (asyncRepository == null) { throw new ArgumentNullException(nameof(asyncRepository)); } if (unitOfWorkFactory == null) { throw new ArgumentNullException(nameof(unitOfWorkFactory)); } this.asyncRepository = asyncRepository; this.unitOfWorkFactory = unitOfWorkFactory; }
public WorkersAsyncService(IWorkerAsyncRepository repository, IDisposableUnitOfWorkFactory unitOfWorkFactory, IDbModelFactory modelFactory, IAsyncRepository <ContactInformation> contactsRepo, IAsyncRepository <Address> addressRepo) : base(repository, unitOfWorkFactory) { Guard.WhenArgument(repository, "IWorkerAsyncRepository").IsNull().Throw(); Guard.WhenArgument(modelFactory, "modelFactory").IsNull().Throw(); Guard.WhenArgument(contactsRepo, "contactsRepo").IsNull().Throw(); Guard.WhenArgument(addressRepo, "addressRepo").IsNull().Throw(); this.workerRepo = repository; this.modelFactory = modelFactory; this.contactsRepo = contactsRepo; this.addressRepo = addressRepo; }
public DishesAsyncService(IDishesAsyncRepository dishesAsyncRepository, IUsersAsyncRepository usersAsyncRepository, IInitializedDishFactory dishFactory, IInitializedVideoItemFactory videoItemFactory, IInitializedPhotoItemFactory photoItemFactory, IDisposableUnitOfWorkFactory unitOfWorkFactory) : base(dishesAsyncRepository, unitOfWorkFactory) { Guard.WhenArgument(dishesAsyncRepository, nameof(IDishesAsyncRepository)).IsNull().Throw(); Guard.WhenArgument(usersAsyncRepository, nameof(IUsersAsyncRepository)).IsNull().Throw(); Guard.WhenArgument(dishFactory, nameof(IDishFactory)).IsNull().Throw(); Guard.WhenArgument(videoItemFactory, nameof(IVideoItemFactory)).IsNull().Throw(); Guard.WhenArgument(photoItemFactory, nameof(IPhotoItemFactory)).IsNull().Throw(); this.dishesAsyncRepository = dishesAsyncRepository; this.usersAsyncRepository = usersAsyncRepository; this.dishFactory = dishFactory; this.videoItemFactory = videoItemFactory; this.photoItemFactory = photoItemFactory; }
public UsersRegistrationAsyncService(IUsersAsyncRepository usersAsyncRepository, IProfilePicturesAsyncRepository profilePicturesAsyncRepository, IDisposableUnitOfWorkFactory unitOfWorkFactory, IInitializedUserFactory userDbModelFactory) : base(usersAsyncRepository, unitOfWorkFactory) { if (userDbModelFactory == null) { throw new ArgumentNullException(nameof(IInitializedUserFactory)); } if (usersAsyncRepository == null) { throw new ArgumentNullException(nameof(IUsersAsyncRepository)); } if (profilePicturesAsyncRepository == null) { throw new ArgumentNullException(nameof(IProfilePicturesAsyncRepository)); } this.userDbModelFactory = userDbModelFactory; this.usersAsyncRepository = usersAsyncRepository; this.profilePicturesAsyncRepository = profilePicturesAsyncRepository; }