public static IEnumerable <Source> GetSources() { var repository = new SourceReadRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString))); var result = repository.ListAsync(null, null, null).Result; return(result); }
public static Source CreateSource(Guid id, string name, string description, IEnumerable <SourceBusinessUnit> sourceBusinessUnits) { // prepare var writeRepository = new SourceWriteRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString))); var readRepository = new SourceReadRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString))); // create var source = new Source(id, name, description); foreach (var sourceBusinessUnit in sourceBusinessUnits) { source.AddSourceBusinessUnit(sourceBusinessUnit); } writeRepository.CreateAsync(source).GetAwaiter().GetResult(); // result var result = readRepository.GetAsync(id).Result; return(result); }