Exemplo n.º 1
0
        public async Task <T> GetOrCreateAsync <T>(T defaultMetadata) where T : class, IDataAcquirerMetadata
        {
            var metadata = await _jobMetadataStorage.GetAsync <T>(_jobId);

            if (metadata == null)
            {
                await _jobMetadataStorage.SaveAsync(_jobId, defaultMetadata);

                return(defaultMetadata);
            }

            return(metadata);
        }
Exemplo n.º 2
0
        public async Task TestAsync(IDataAcquirerMetadataStorage storage)
        {
            var twitterMetadata = new TwitterMetadata()
            {
                BatchSize = 1,
                Language  = "en",
                MaxId     = 111,
                Query     = "q1",
                SinceId   = 2
            };
            var jobId = Guid.NewGuid();
            await storage.SaveAsync(jobId, twitterMetadata);

            var retreived = await storage
                            .GetAsync <TwitterMetadata>(jobId);

            var errors = AssertObject(twitterMetadata, retreived);

            AssertErrors("insert metadata", errors);
        }