Пример #1
0
        protected Member[] InsertMembers(int numberOfMembersToCreate)
        {
            Member[] members = new Member[numberOfMembersToCreate];

            for (int currentMemberIndex = 0; currentMemberIndex < numberOfMembersToCreate; currentMemberIndex++)
            {
                Member member = new Member()
                {
                    CardId   = Guid.NewGuid().ToString(),
                    NickName = $"nickname {Guid.NewGuid()}",
                };

                members[currentMemberIndex] = member;
            }

            AbstractData.Insert(_mongoConnection, members);

            return(members);
        }
Пример #2
0
        protected VisitTimeAlert[] InsertVisitTimeAlerts(Member[] members, int numberOfVisitTimeAlertsToCreate, int timeFromLatestVisitBeforeAlertHours)
        {
            VisitTimeAlert[] visitTimeAlerts = new VisitTimeAlert[numberOfVisitTimeAlertsToCreate];

            TimeSpan timeFromLatestVisitBeforeAlert = TimeSpan.FromHours(_random.NextDouble() * timeFromLatestVisitBeforeAlertHours);

            for (int currentVisitTimeAlertIndex = 0; currentVisitTimeAlertIndex < numberOfVisitTimeAlertsToCreate; currentVisitTimeAlertIndex++)
            {
                VisitTimeAlert visitTimeAlert = new VisitTimeAlert(members[_random.Next(0, members.Length)])
                {
                    TimeFromLatestVisitBeforeAlert = timeFromLatestVisitBeforeAlert,
                };

                visitTimeAlerts[currentVisitTimeAlertIndex] = visitTimeAlert;
            }

            AbstractData.Insert(_mongoConnection, visitTimeAlerts);

            return(visitTimeAlerts);
        }
Пример #3
0
        protected Visit[] InsertVisits(Member[] members, int numberOfVisitsToCreate, int visitAgeHours)
        {
            Visit[] visits = new Visit[numberOfVisitsToCreate];

            DateTime visitTime = DateTime.Now - TimeSpan.FromHours(_random.NextDouble() * visitAgeHours);

            for (int currentVisitIndex = 0; currentVisitIndex < numberOfVisitsToCreate; currentVisitIndex++)
            {
                Visit visit = new Visit(members[_random.Next(0, members.Length)].Id)
                {
                    VisitTime = visitTime,
                };

                visits[currentVisitIndex] = visit;
            }

            AbstractData.Insert(_mongoConnection, visits);

            return(visits);
        }