public async Task DataRequestsForSystemOperation_UpdateToCompleteWithDuplicates_UpdatesRelevantRequests()
        {
            var repo = new RuleRunDataRequestRepository(new ConnectionStringFactory(this._configuration), this._logger);

            var id = "11";

            var start = DateTime.UtcNow;
            var end   = DateTime.UtcNow.AddHours(1);

            var marketDataRequest1 = new MarketDataRequest(
                null,
                "TESTME",
                "entsbp",
                new InstrumentIdentifiers {
                Id = "1"
            },
                start,
                end,
                "1",
                false,
                DataSource.Bmll);

            await repo.CreateDataRequest(marketDataRequest1);

            var marketDataRequest2 = new MarketDataRequest(
                null,
                "TESTME",
                "entsbp",
                new InstrumentIdentifiers {
                Id = "1"
            },
                start,
                end,
                "2",
                false,
                DataSource.Bmll);

            await repo.CreateDataRequest(marketDataRequest2);

            var dataRequests = (await repo.DataRequestsForSystemOperation(id))
                               .Where(_ => _.MarketIdentifierCode == "TESTME").ToList();

            Assert.IsNotNull(dataRequests);
            Assert.AreEqual(dataRequests.Count, 2);
            Assert.IsFalse(dataRequests.All(_ => _.IsCompleted));

            var oneDataRequest = new[] { dataRequests.FirstOrDefault() };
            await repo.UpdateToCompleteWithDuplicates(oneDataRequest);

            var dataRequests2 = (await repo.DataRequestsForSystemOperation(id))
                                .Where(_ => _.MarketIdentifierCode == "TESTME").ToList();

            Assert.IsTrue(dataRequests2.All(_ => _.IsCompleted));
        }
        public async Task DataRequestsForSystemOperation_StoredOperationId_ReturnsDataRequests()
        {
            var repo = new RuleRunDataRequestRepository(new ConnectionStringFactory(this._configuration), this._logger);

            var id = "1";

            var marketDataRequest = new MarketDataRequest(
                null,
                "XLON",
                "entsbp",
                new InstrumentIdentifiers {
                Id = "1"
            },
                DateTime.UtcNow,
                DateTime.UtcNow.AddHours(1),
                id,
                true,
                DataSource.Bmll);

            await repo.CreateDataRequest(marketDataRequest);

            var dataRequests = await repo.DataRequestsForSystemOperation("11");

            Assert.IsNotNull(dataRequests);
            Assert.AreEqual(dataRequests.Count, 1);
        }
        public async Task GetDataRequests_FetchesFromDb()
        {
            var repo = new RuleRunDataRequestRepository(new ConnectionStringFactory(this._configuration), this._logger);

            var results = await repo.DataRequestsForSystemOperation("2");

            Assert.IsNotNull(results);
        }
        public async Task DataRequestsForSystemOperation_NullOperationId_ReturnsEmpty()
        {
            var repo = new RuleRunDataRequestRepository(new ConnectionStringFactory(this._configuration), this._logger);

            await repo.DataRequestsForSystemOperation(null);
        }