Beispiel #1
0
        public void CreateProjectsHealthRisks()
        {
            var risks = JsonConvert.DeserializeObject <HealthRiskCreated[]>(
                System.IO.File.ReadAllText("./TestData/HealthRisks.json"));
            var projects =
                JsonConvert.DeserializeObject <ProjectCreated[]>(System.IO.File.ReadAllText("./TestData/Projects.json"));

            foreach (var project in projects)
            {
                var healthRiskIds = new List <Guid>();
                var randomizer    = new Random();

                var events = new List <ProjectHealthRiskThresholdUpdate>();
                for (var i = 0; i < 5; i++)
                {
                    var availableRisks = risks.Where(v => !healthRiskIds.Contains(v.Id));
                    var risk           = availableRisks.Skip(randomizer.Next(availableRisks.Count())).First();
                    events.Add(new ProjectHealthRiskThresholdUpdate()
                    {
                        ProjectId    = project.Id,
                        HealthRiskId = risk.Id,
                        Threshold    = 0
                    });
                }
                _eventReplayer.Replay(events, e => e.HealthRiskId);
            }
        }
        public void CreateHealthRisks()
        {
            var _collection = _database.GetCollection <HealthRisk>("HealthRisk");

            _collection.DeleteMany(v => true);

            var healthRisks = JsonConvert.DeserializeObject <HealthRiskCreated[]>(System.IO.File.ReadAllText("./TestData/HealthRisks.json"));

            _eventReplayer.Replay(healthRisks, _ => _.Id);
        }
        public void CreateCaseReports()
        {
            var list = JsonConvert.DeserializeObject <CaseReportReceived[]> (
                System.IO.File.ReadAllText("./TestData/CaseReports.json"));

            _eventReplayer.Replay(list, e => e.CaseReportId);
        }