コード例 #1
0
ファイル: WebEventData.cs プロジェクト: zzl1010/aspnetcore
 public static WebEventData Parse(WebEventDescriptor eventDescriptor, string eventArgsJson)
 {
     return(new WebEventData(
                eventDescriptor.BrowserRendererId,
                eventDescriptor.EventHandlerId,
                InterpretEventFieldInfo(eventDescriptor.EventFieldInfo),
                ParseEventArgsJson(eventDescriptor.EventHandlerId, eventDescriptor.EventArgsType, eventArgsJson)));
 }
コード例 #2
0
        public static WebEventData Parse(Renderer renderer, WebEventDescriptor eventDescriptor, string eventArgsJson)
        {
            var parsedEventArgs = ParseEventArgsJson(renderer, eventDescriptor.EventHandlerId, eventDescriptor.EventName, eventArgsJson);

            return(new WebEventData(
                       eventDescriptor.BrowserRendererId,
                       eventDescriptor.EventHandlerId,
                       InterpretEventFieldInfo(eventDescriptor.EventFieldInfo),
                       parsedEventArgs));
        }
コード例 #3
0
 public static WebEventData Parse(
     Renderer renderer,
     JsonSerializerOptions jsonSerializerOptions,
     WebEventDescriptor eventDescriptor,
     JsonElement eventArgsJson)
 {
     var parsedEventArgs = ParseEventArgsJson(renderer, jsonSerializerOptions, eventDescriptor.EventHandlerId, eventDescriptor.EventName, eventArgsJson);
     return new WebEventData(
         eventDescriptor.EventHandlerId,
         eventDescriptor.EventFieldInfo,
         parsedEventArgs);
 }
コード例 #4
0
        public void Read_WithBoolValue_Works(bool value)
        {
            // Arrange
            var args = new WebEventDescriptor
            {
                EventFieldInfo = new EventFieldInfo
                {
                    ComponentId = 89,
                    FieldValue  = value,
                },
                EventHandlerId = 897,
                EventName      = "test1",
            };
            var jsonElement = GetJsonElement(args);

            // Act
            var result = WebEventDescriptorReader.Read(jsonElement);

            // Assert
            Assert.Equal(args.EventHandlerId, result.EventHandlerId);
            Assert.Equal(args.EventName, result.EventName);
            Assert.Equal(args.EventFieldInfo.ComponentId, result.EventFieldInfo.ComponentId);
            Assert.Equal(args.EventFieldInfo.FieldValue, result.EventFieldInfo.FieldValue);
        }