Пример #1
0
        PatientAggregate GenerateRandomAggregate()
        {
            var graph = new PatientAggregate
            {
                Id = Guid.NewGuid(),
                PersonId = Guid.NewGuid(),
                UserId = Guid.NewGuid(),
                SapCode =  StringExtension.RandomString(10),
                TimeStamp = DateTimeOffset.Now
            };
            graph.User = new User
            {
                Id = graph.UserId.Value,
                Active = new Random().Next(),
                Email = StringExtension.RandomString(),
                ForgotPasswordCode = StringExtension.RandomString(5),
                ForgotPasswordRequest = DateTimeExtension.RandomDateTimeOffset(),
                Hash = StringExtension.RandomString(5),
                LanguageId = Guid.NewGuid(),
                LastChangePassword = DateTimeExtension.RandomDateTimeOffset(),
                LastLogon = DateTimeExtension.RandomDateTimeOffset(),
                Locked = new Random().Next(),
                NewEmail = StringExtension.RandomString(5),
                NewEmailCode = StringExtension.RandomString(5),
                NewEmailRequest = DateTimeExtension.RandomDateTimeOffset(),
                RecordDeleted = new Random().Next(),
                RecordDeletedDate = DateTimeExtension.RandomDateTimeOffset(),
                RegistrationDate = DateTimeExtension.RandomDateTimeOffset(),
                RegistrationCode = StringExtension.RandomString(5),
                RetryCount = new Random().Next(),
                TokenHash = StringExtension.RandomString(5),
                UserName = StringExtension.RandomString(5),
                TimeStamp = DateTimeOffset.Now
            };

            graph.Person = new Person
            {
                Id = graph.PersonId,
                BirthDate = DateTimeExtension.RandomDateTime(),
                CurrencyId = Guid.NewGuid(),
                Deleted = new Random().Next(),
                DocumentIdentifier = StringExtension.RandomString(5),
                DocumentTypeId = Guid.NewGuid(),
                Email = StringExtension.RandomString(5),
                Gender = new Random().Next(),
                Name = StringExtension.RandomString(5),
                LanguageId = Guid.NewGuid(),
                NationalityId = Guid.NewGuid(),
                Phone1 = StringExtension.RandomString(5),
                Phone2 = StringExtension.RandomString(5),
                Surname1 = StringExtension.RandomString(5),
                Surname2 = StringExtension.RandomString(5),
                TitleId = Guid.NewGuid(),
                TimeStamp = DateTimeExtension.RandomDateTime(),
                PersonLocation = new Collection<PersonLocation>
                {
                    new PersonLocation
                    {
                        Id = Guid.NewGuid(),
                        LocationId = Guid.NewGuid(),
                        PersonId = graph.PersonId,
                        TimeStamp= DateTimeExtension.RandomDateTime()
                    }
                }
            };
            
            return graph;
        }
Пример #2
0
 BaseEvent GenerateMessage(PatientAggregate aggregate)
 {
     var serializedAggregate = new JsonSerializer().Serialize<PatientAggregate>(aggregate);
     return new BaseEvent
     {
         EventID = Guid.NewGuid(),
         MessageOriginator = "Tester",
         MessageType = typeof(RegisteredPatient).Name,
         Topic = "Service",
         Aggregate = new CryptoManager().Encrypt(serializedAggregate, HostPasswordConfigFake.GetHostPassword())
     };
 }