예제 #1
0
 MachineAggregate GenerateRandomAggregate()
 {
     var graph = new MachineAggregate
     {
         Id = Guid.NewGuid(),
         DeviceIdentifier = StringExtension.RandomString(10),
         Deleted = new Random().Next(),
         Ip = StringExtension.RandomString(10),
         SortOrder = new Random().Next(),
         StreamingPort = new Random().Next(),
         PortState = new Random().Next(),
         PartnerId = Guid.NewGuid(),
         Port = new Random().Next(),
         UserFriendlyName = StringExtension.RandomString(),
         DescriptionKeyId = StringExtension.RandomString(10),
         SerialNumber = StringExtension.RandomString(10),
         SapCode =  StringExtension.RandomString(10),
         TimeStamp = DateTimeOffset.Now,
         MachineGroupId = Guid.NewGuid()
     };
     graph.MachineGroup = new MachineGroup
     {
         Id = graph.MachineGroupId,
         Deleted = new Random().Next(),
         NameKeyId = StringExtension.RandomString(10),
         SapCode = "SAP-CODE",
         TimeStamp = DateTimeOffset.Now
     };
     graph.MachinePrinter = new Collection<MachinePrinter>
     {
         new MachinePrinter
         {
             Id = Guid.NewGuid(),
             MachineId = graph.Id,
             PrinterId = Guid.NewGuid(),
             Function = new Random().Next(),
             TimeStamp = DateTimeOffset.Now
         }
     };
     
     return graph;
 }
예제 #2
0
 BaseEvent GenerateMessage(MachineAggregate aggregate)
 {
     var serializedAggregate = new JsonSerializer().Serialize<MachineAggregate>(aggregate);
     return new BaseEvent
     {
         EventID = Guid.NewGuid(),
         MessageOriginator = "Tester",
         MessageType = typeof(RegisteredMachine).Name,
         Topic = "Service",
         Aggregate = new CryptoManager().Encrypt(serializedAggregate, HostPasswordConfigFake.GetHostPassword())
     };
 }