コード例 #1
0
        public void CanWriteSelectSomeWrapperToJsonUsingNewtonsoftJsonConverter()
        {
            // Arrange
            SelectSome <Customer> selectSome = new SelectSome <Customer>();
            MockPropertyContainer container  = new MockPropertyContainer();

            container.Properties["Name"] = "sam";
            selectSome.Container         = container;
            selectSome.Model             = _edmModel;

            JSelectExpandWrapperConverter converter = new JSelectExpandWrapperConverter();

            // Act
            string json = SerializeUtils.WriteJson(converter, selectSome);

            // Assert
            Assert.Equal("{\"Name\":\"sam\"}", json);
        }
コード例 #2
0
 public override void Write(Utf8JsonWriter writer, SelectSome <TEntity> value, JsonSerializerOptions options)
 {
     JsonSerializer.Serialize(writer, value.ToDictionary(SelectExpandWrapperConverter.MapperProvider), options);
 }