Ejemplo n.º 1
0
 ServiceAggregate GenerateRandomAggregate()
 {
     var graph = new ServiceAggregate
     {
         Id = Guid.NewGuid(),
         NameKeyId = StringExtension.RandomString(20),
         LongDescriptionKeyId = StringExtension.RandomString(33),
         Cover = Encoding.UTF8.GetBytes(StringExtension.RandomString()),
         CoverType = StringExtension.RandomString(4),
         Deleted = new Random().Next(),
         ServiceTypeId = Guid.NewGuid(),
         DecisionTreeId = Guid.NewGuid(),
         SapCode =  StringExtension.RandomString(10),
         TimeStamp = DateTimeOffset.Now
     };
     graph.ServiceType = new ServiceType
     {
         Id = graph.ServiceTypeId,
         NameKeyId = StringExtension.RandomString(30),
         LongDescriptionKeyId = StringExtension.RandomString(30),
         Length = new Random().Next(),
         Type = new Random().Next(),
         Deleted = new Random().Next(),
         SapCode = StringExtension.RandomString(19),
         TimeStamp = DateTimeOffset.Now
     };
     graph.ServiceLevel = new List<ServiceLevel>
     {
         new ServiceLevel
         {
             Id = Guid.NewGuid(),
             NameKeyId = StringExtension.RandomString(30),
             LongDescriptionKeyId  = StringExtension.RandomString(30),
             Deleted = new Random().Next(),
             ServiceId =  graph.Id,
             SapCode  = StringExtension.RandomString(17),
             TimeStamp = DateTimeOffset.Now,
             ServicePrice = new List<ServicePrice>()
         }
     };
     graph.ServiceLevel.First().ServicePrice.Add(new ServicePrice
         {
             Id = Guid.NewGuid(),
             ServiceLevelId = graph.ServiceLevel.First().Id,
             BeginPeriod = DateTime.Now.AddYears(-2),
             EndPeriod = DateTime.Now,
             CountryId = Guid.NewGuid(),
             CurrencyId = Guid.NewGuid(),
             Price = (float)new Random().NextDouble(),
             SapCode = StringExtension.RandomString(30),
             TimeStamp = DateTimeOffset.Now,
             TaxClass = StringExtension.RandomString(1),
         });
     return graph;
 }
Ejemplo n.º 2
0
 BaseEvent GenerateMessage(ServiceAggregate aggregate)
 {
     var serializedAggregate = new JsonSerializer().Serialize<ServiceAggregate>(aggregate);
     return new BaseEvent
     {
         EventID = Guid.NewGuid(),
         MessageOriginator = "Tester",
         MessageType = typeof(RegisteredService).Name,
         Topic = "Service",
         Aggregate = new CryptoManager().Encrypt(serializedAggregate, HostPasswordConfigFake.GetHostPassword())
     };
 }