public SendEventResponseDto SendEvent(SendEventRequestDto request) { var coreRequest = GetCoreRequest <Zidium.Core.Api.SendEventRequest>(request); coreRequest.Data = AdapterDataConverter.ConvertToCore(request.Data); var coreResponse = Dispatcher.SendEvent(coreRequest); var response = GetApiResponse <SendEventResponseDto>(coreResponse); response.Data = AdapterDataConverter.ConvertToApi(coreResponse.InternalData); return(response); }
public SendEventResponse SendEvent(SendEventData data) { var dataDto = DataConverter.GetSendEventRequestDtoData(data); var request = new SendEventRequestDto { Data = dataDto, Token = GetAccessTokenDto() }; var responseDto = DtoService.SendEvent(request); var response = CreateResponse <SendEventResponse>(responseDto); response.InternalData = DataConverter.GetsSendEventResponseDtoData(responseDto.Data); return(response); }
public void JsonTest() { var serializers = GetSerializers(); foreach (var serializer in serializers) { var request = new SendEventRequestDto(); request.Token = new AccessTokenDto() { AccountId = Guid.NewGuid(), Program = Guid.NewGuid().ToString(), SecretKey = Guid.NewGuid().ToString() }; request.Data = new SendEventRequestDtoData() { ComponentId = Guid.NewGuid(), Category = SendEventCategory.ComponentEvent, Count = 3, Importance = EventImportance.Alarm, Message = "Всем привет, это строка на русском языке", StartDate = DateTime.Now, TypeCode = "code", JoinIntervalSeconds = 200, JoinKey = 34324, Properties = new List <ExtentionPropertyDto>(), TypeSystemName = "type" + Guid.NewGuid(), Version = "1.0" }; TestHelper.InitRandomProperties(request.Data.Properties); var data1 = serializer.GetBytes(request); var text = Encoding.UTF8.GetString(data1); var request2 = serializer.GetObject(request.GetType(), data1); var data2 = serializer.GetBytes(request2); TestHelper.AreEqual(data1, data2); } }
public SendEventResponseDto SendEvent(SendEventRequestDto request) { return(ExecuteAction <SendEventResponseDto>("SendEvent", request)); }