private Event CreateSimpleEvent()
        {
            var ev = new Event {
                Date    = DateTime.Now,
                Message = "Testing",
                Type    = Event.KnownTypes.Log,
                Source  = "StorageSerializer"
            };

            if (RandomData.GetBool(80))
            {
                ev.Geo = RandomData.GetCoordinate();
            }
            if (RandomData.GetBool(20))
            {
                ev.Value = RandomData.GetDecimal();
            }
            if (RandomData.GetBool(20))
            {
                ev.Count = RandomData.GetInt();
            }
            if (RandomData.GetBool(80))
            {
                ev.ReferenceId = RandomData.GetAlphaNumericString(0, 10);
            }
            return(ev);
        }
Beispiel #2
0
        public static Stack GenerateStack(bool generateId = false, string id = null, string organizationId = null, string projectId = null, string type = null, string title = null, DateTime?dateFixed = null, DateTime?utcFirstOccurrence = null, DateTime?utcLastOccurrence = null, int totalOccurrences = 0, bool isRegressed = false, bool isHidden = false, string signatureHash = null)
        {
            var stack = new Stack {
                Id               = id.IsNullOrEmpty() ? generateId ? ObjectId.GenerateNewId().ToString() : null : id,
                OrganizationId   = organizationId.IsNullOrEmpty() ? TestConstants.OrganizationId : organizationId,
                ProjectId        = projectId.IsNullOrEmpty() ? TestConstants.ProjectIds.Random() : projectId,
                Title            = title ?? RandomData.GetTitleWords(),
                Type             = type ?? Stack.KnownTypes.Error,
                DateFixed        = dateFixed,
                FirstOccurrence  = utcFirstOccurrence ?? DateTime.MinValue,
                LastOccurrence   = utcLastOccurrence ?? DateTime.MinValue,
                TotalOccurrences = totalOccurrences,
                IsRegressed      = isRegressed,
                IsHidden         = isHidden,
                SignatureHash    = signatureHash ?? RandomData.GetAlphaNumericString(10, 10),
                SignatureInfo    = new SettingsDictionary()
            };

            for (int i = 0; i < RandomData.GetInt(0, 5); i++)
            {
                string tag = RandomData.GetWord();
                while (stack.Tags.Contains(tag))
                {
                    tag = RandomData.GetWord();
                }

                stack.Tags.Add(tag);
            }

            return(stack);
        }
Beispiel #3
0
        public static Stack GenerateStack(bool generateId = false, string id = null, string organizationId = null, string projectId = null, string type = null, string title = null, DateTime?dateFixed = null, DateTime?utcFirstOccurrence = null, DateTime?utcLastOccurrence = null, int totalOccurrences = 0, StackStatus status = StackStatus.Open, string signatureHash = null)
        {
            var utcNow = SystemClock.UtcNow;
            var stack  = new Stack {
                Id               = id.IsNullOrEmpty() ? generateId ? ObjectId.GenerateNewId().ToString() : null : id,
                OrganizationId   = organizationId.IsNullOrEmpty() ? TestConstants.OrganizationId : organizationId,
                ProjectId        = projectId.IsNullOrEmpty() ? TestConstants.ProjectIds.Random() : projectId,
                Title            = title ?? RandomData.GetTitleWords(),
                Type             = type ?? Stack.KnownTypes.Error,
                DateFixed        = dateFixed,
                FirstOccurrence  = utcFirstOccurrence ?? utcNow,
                LastOccurrence   = utcLastOccurrence ?? utcNow,
                TotalOccurrences = totalOccurrences,
                Status           = status,
                SignatureHash    = signatureHash ?? RandomData.GetAlphaNumericString(10, 10),
                SignatureInfo    = new SettingsDictionary()
            };

            stack.DuplicateSignature = String.Concat(stack.ProjectId, ":", stack.SignatureHash);

            if (type == Event.KnownTypes.Error)
            {
                stack.SignatureInfo.Add("ExceptionType", TestConstants.ExceptionTypes.Random());
            }

            for (int i = 0; i < RandomData.GetInt(0, 5); i++)
            {
                string tag = RandomData.GetWord();
                while (stack.Tags.Contains(tag))
                {
                    tag = RandomData.GetWord();
                }

                stack.Tags.Add(tag);
            }

            return(stack);
        }