Example #1
0
        public void SerializeNullDictionary()
        {
            UpdateIdentities ui = new UpdateIdentities();

            ui.RequestType = "PUT";
            ui.Identities  = null;

            var identJson = SafeJsonConvert.SerializeObject(ui, GetStdSerializedSettings());

            Assert.NotNull(identJson);
        }
Example #2
0
        public void SerializeEmptyDictionary()
        {
            UpdateIdentities ui = new UpdateIdentities();

            ui.RequestType = "PUT";

            Dictionary <string, UserAssignedIdentity> users = new Dictionary <string, UserAssignedIdentity>();

            users.Add("New", new UserAssignedIdentity());
            users.Add("Remove", null);

            ui.Identities = users;

            var identJson = SafeJsonConvert.SerializeObject(ui, GetStdSerializedSettings());

            Assert.NotNull(identJson);
        }
Example #3
0
        public void SerializeAndParse()
        {
            UpdateIdentities ui = new UpdateIdentities();

            ui.RequestType = "PUT";

            Dictionary <string, UserAssignedIdentity> users = new Dictionary <string, UserAssignedIdentity>();

            users.Add("New", new UserAssignedIdentity());
            users.Add("Remove", null);

            ui.Identities = users;

            var identJson = SafeJsonConvert.SerializeObject(ui, GetStdSerializedSettings());

            Assert.NotNull(identJson);

            JObject body = JObject.Parse(identJson);

            UpdateIdentities deserializedUI = body.ToObject <UpdateIdentities>(JsonSerializer.Create(GetStdDeserializationSettings()));
        }