コード例 #1
0
        public async Task Create_Creates_AsExpected()
        {
            var connectionStringFactory = new ConnectionStringFactory(this._configuration);
            var repo = new RuleBreachRepository(connectionStringFactory, this._logger);

            var caseMessage = new RuleBreach(
                100,
                "rule-1",
                "correlation-id",
                true,
                DateTime.UtcNow,
                "case-title",
                "case-description",
                "xlon",
                DateTime.UtcNow,
                DateTime.UtcNow,
                "entspb",
                "RD00",
                "0",
                0,
                "1",
                true,
                new int[0]);

            var result = await repo.Create(caseMessage);
        }
コード例 #2
0
        public async Task Get_Duplicates_When_NoDuplicates_Reports_AsExpected()
        {
            var connectionStringFactory = new ConnectionStringFactory(this._configuration);
            var repo = new RuleBreachRepository(connectionStringFactory, this._logger);

            var caseMessage1 = new RuleBreach(
                900,
                "rule-9",
                "correlation-id",
                true,
                DateTime.UtcNow,
                "case-title",
                "case-description",
                "xlon",
                DateTime.UtcNow,
                DateTime.UtcNow,
                "entspb",
                "RD00",
                "0",
                0,
                "1",
                true,
                new int[0]);

            var result1 = await repo.Create(caseMessage1);

            var orderRepo = new RuleBreachOrdersRepository(
                connectionStringFactory,
                new NullLogger <RuleBreachOrdersRepository>());

            var breaches1 = Enumerable.Range(0, 50).Select(i => new RuleBreachOrder(result1.ToString(), i.ToString()))
                            .ToList();
            await orderRepo.Create(breaches1);

            var result = await repo.HasDuplicate(result1.ToString());

            Assert.IsFalse(result);
        }