public WebPaginggTests(DefaultFixture fixture) { _fixture = fixture; _storage = new InMemoryStorageService(); _repo = new OpenRepository <User>(_storage, _fixture.RightsService); _collection = new UsersCollection(_repo, _fixture.PatcherProvider, _fixture.Instanciator); }
public Facts(ITestOutputHelper output) { StorageService = new InMemoryStorageService(); HttpCacheUtility = new LocalStorageHttpCacheUtility(StorageService); ConcurrencyUtility = new InMemoryConcurrencyUtility(); SourceRepository = Repository.Factory.GetCustomRepository(HttpCacheUtility, ConcurrencyUtility); Logger = new XunitLogger <VersionRangeCalculator>(output); Token = CancellationToken.None; Target = new VersionRangeCalculator( SourceRepository.GetResourceAsync <PackageMetadataResource>(), Logger); }
public async void NonAbstractCollection_SHOULD_return_all_entities_WHEN_GetAll_is_called() { var rightsService = new OpenRightExpressionsHelper <ConcreteClassThree>(); var storage = new InMemoryStorageService(); var repo = new OpenRepository <ConcreteClassThree>(storage, rightsService); await repo.AddAsync(new ConcreteClassThree(), new Query <ConcreteClassThree> { Verb = Helpers.HttpVerbs.Post }); await repo.AddAsync(new ConcreteClassThree(), new Query <ConcreteClassThree> { Verb = Helpers.HttpVerbs.Post }); var collection = new ConcreteClassThreeCollection(repo); var result = await collection.GetAsync(new Query <ConcreteClassThree>()); Assert.Equal(2, result.Items.Count()); }
public DefaultFixture() { var services = new ServiceCollection(); services.TryAddSingleton <IReflectionHelper, ReflectionHelper>(); services.TryAddSingleton <IPatcherProvider, PatcherProvider>(); services.TryAddSingleton <EnumerablePatcher>(); services.TryAddSingleton <DictionaryPatcher>(); services.TryAddSingleton <ValuePatcher>(); services.TryAddSingleton <DynamicPatcher>(); services.TryAddSingleton <ObjectPatcher>(); services.TryAddSingleton <IIncludeApplicator, IncludeApplicator>(); ServiceProvider = services.BuildServiceProvider(); RightsService = new OpenRightExpressionsHelper <User>(); Instanciator = new DefaultInstanciator <User>(); InMemoryStorage = new InMemoryStorageService(); IncludeApplicator = ServiceProvider.GetRequiredService <IIncludeApplicator>(); UsersRepo = new Repository <User>(InMemoryStorage, RightsService, IncludeApplicator); }
public async Task WebControllerShouldWorkOnInterfaces() { var storage = new InMemoryStorageService(); var repository = new Repository <IUser>(storage, new OpenRightExpressionsHelper <IUser>(), new IncludeApplicator()); var collection = new ReadOnlyRestCollection <IUser, int>(repository); var appController = new ReadOnlyAppController <IUser, int>(collection); await repository.AddAsync(new User { Id = 1 }, new Query <IUser> { Verb = Domain.Helpers.HttpVerbs.Post }); await repository.AddAsync(new AnotherUser { Id = 2 }, new Query <IUser> { Verb = Domain.Helpers.HttpVerbs.Post }); var controller = new UserWebController(appController, QueryParserHelper.GetQueryParser <IUser>()); var results = await controller.GetEnumerable(); //Simplified equivalent to Get() Assert.Equal(2, results.Count()); }