@@ -381,6 +381,70 @@ private async Task<IDictionary<string, object>> UpdateStronglyTypedTest<T>(Actio
381381
382382 /* =================================================================== CUSTOM PROPERTIES */
383383
384+ private class TestContent_IgnoredProperties : Content
385+ {
386+ public TestContent_IgnoredProperties ( IRestCaller restCaller , ILogger < Content > logger ) : base ( restCaller , logger ) { }
387+
388+ public int Index { get ; set ; }
389+ public string String1 { get ; set ; }
390+ [ JsonIgnore ]
391+ public string String2 { get ; set ; }
392+ [ System . Text . Json . Serialization . JsonIgnore ]
393+ public string String3 { get ; set ; }
394+ }
395+ [ TestMethod ]
396+ public async Task Content_T_IgnoredProperty_Save ( )
397+ {
398+ var restCaller = CreateRestCallerFor ( @"{
399+ ""d"": {
400+ ""Id"": 999543,
401+ ""Name"": ""MyContent"",
402+ ""Path"": ""/Root/MyContent"",
403+ ""Type"": ""Folder"",
404+ }
405+ }" ) ;
406+
407+ var repositories = GetRepositoryCollection ( services =>
408+ {
409+ services . RegisterGlobalContentType < TestContent_IgnoredProperties > ( ) ;
410+ services . AddSingleton ( restCaller ) ;
411+ } ) ;
412+ var repository = await repositories . GetRepositoryAsync ( FakeServer , CancellationToken . None )
413+ . ConfigureAwait ( false ) ;
414+
415+ // ACT
416+ var content = repository . CreateContent < TestContent_IgnoredProperties > ( "/Root/Content" , null , "MyContent-1" ) ;
417+ content . Index = 9998 ;
418+ content . String1 = "String1Value" ;
419+ content . String2 = "String2Value" ;
420+ content . String3 = "String3Value" ;
421+ await content . SaveAsync ( CancellationToken . None ) . ConfigureAwait ( false ) ;
422+
423+ // ASSERT
424+ var calls = restCaller . ReceivedCalls ( ) . ToArray ( ) ;
425+ Assert . IsNotNull ( calls ) ;
426+ Assert . AreEqual ( 2 , calls . Length ) ;
427+ Assert . AreEqual ( "GetResponseStringAsync" , calls [ 1 ] . GetMethodInfo ( ) . Name ) ;
428+ var arguments = calls [ 1 ] . GetArguments ( ) ;
429+ Assert . IsTrue ( arguments [ 0 ] . ToString ( ) . Contains ( "Root('Content')" ) ) ;
430+ Assert . AreEqual ( HttpMethod . Post , arguments [ 1 ] ) ;
431+ var json = ( string ) arguments [ 2 ] ! ;
432+ json = json . Substring ( "models=[" . Length ) . TrimEnd ( ']' ) ;
433+ dynamic data = JsonHelper . Deserialize ( json ) ;
434+ Dictionary < string , object > fields = data . ToObject < Dictionary < string , object > > ( ) ;
435+
436+ var names = string . Join ( ", " , fields . Keys . OrderBy ( x => x ) ) ;
437+ Assert . AreEqual ( "__ContentType, Existing, Index, Name, String1" , names ) ;
438+ Assert . IsNotNull ( data ) ;
439+ Assert . AreEqual ( "TestContent_IgnoredProperties" , data . __ContentType . ToString ( ) ) ;
440+ Assert . AreEqual ( "MyContent-1" , data . Name . ToString ( ) ) ;
441+ Assert . AreEqual ( "False" , data . Existing . ToString ( ) ) ;
442+ Assert . AreEqual ( "9998" , data . Index . ToString ( ) ) ;
443+ Assert . AreEqual ( "String1Value" , data . String1 . ToString ( ) ) ;
444+ }
445+
446+ /* =================================================================== CUSTOM PROPERTIES */
447+
384448 #region Nested classes: CustomType1, TestContent_CustomProperties
385449 private class CustomType1
386450 {
0 commit comments