Пример #1
0
 public CustomNotificationsTests()
 {
     _notifications = new CustomNotifications { Attempt = 1, Id = "123456" };
     _notifications.Properties.Add("pk1", "pv1");
     _notifications.Properties.Add("pk2", "pv2");
     _notifications.Notifications.Add(new Dictionary<string, object> { { "nk1", "nv1" } });
     _notifications.Notifications.Add(new Dictionary<string, object> { { "nk2", "nv2" } });
 }
Пример #2
0
        public void Serialization_Roundtrips()
        {
            // Act
            string ser = JsonConvert.SerializeObject(_notifications, _settings);
            CustomNotifications actual = JsonConvert.DeserializeObject <CustomNotifications>(ser, _settings);

            // Assert
            Assert.Equal("123456", actual.Id);
            Assert.Equal(1, actual.Attempt);
            Assert.Equal("pv1", actual.Properties["pk1"]);
            Assert.Equal("pv2", actual.Properties["pk2"]);
            Assert.Equal("nv1", actual.Notifications.ElementAt(0)["nk1"]);
            Assert.Equal("nv2", actual.Notifications.ElementAt(1)["nk2"]);
        }
Пример #3
0
 public CustomNotificationsTests()
 {
     _notifications = new CustomNotifications {
         Attempt = 1, Id = "123456"
     };
     _notifications.Properties.Add("pk1", "pv1");
     _notifications.Properties.Add("pk2", "pv2");
     _notifications.Notifications.Add(new Dictionary <string, object> {
         { "nk1", "nv1" }
     });
     _notifications.Notifications.Add(new Dictionary <string, object> {
         { "nk2", "nv2" }
     });
 }