public void TestUpdateSubscription() { foreach (var dataService in DataServices) { // Arrange. string clientId = "Client ID"; string messageTypeId = "MessageType ID"; TransportType transportType = TransportType.WEB; DateTime expiryDate = new DateTime(2015, 7, 20); var service = new DefaultSubscriptionsManager(dataService, GetMockStatisticsService()); service.CreateClient(clientId, "Client name"); service.CreateMessageType(new ServiceBusMessageType { ID = messageTypeId, Name = "MessageType name", }); service.SubscribeOrUpdate(clientId, messageTypeId, true, transportType, expiryDate); // Act && Assert. var subscriptionLcs = LoadingCustomizationStruct.GetSimpleStruct(typeof(Subscription), Subscription.Views.SendingByCallbackView); var subscriptions = dataService.LoadObjects(subscriptionLcs).Cast <Subscription>().ToList(); Assert.Equal(subscriptions.Count(), 1); Assert.Equal(subscriptions[0].MessageType.ID, messageTypeId); Assert.Equal(subscriptions[0].Client.ID, clientId); Assert.Equal(subscriptions[0].IsCallback, true); Assert.Equal(subscriptions[0].TransportType, transportType); Assert.Equal(subscriptions[0].ExpiryDate, expiryDate); ServiceBusSubscription newSubscriptionData = new ServiceBusSubscription() { Callback = false, Description = "new description", ExpiryDate = new DateTime(2017, 8, 20), SendBy = "MAIL", }; service.UpdateSubscription(subscriptions[0].__PrimaryKey.ToString(), newSubscriptionData); var newSubscriptions = dataService.LoadObjects(subscriptionLcs).Cast <Subscription>().ToList(); Assert.Equal(newSubscriptions.Count(), 1); Assert.Equal(newSubscriptions[0].MessageType.ID, messageTypeId); Assert.Equal(newSubscriptions[0].Client.ID, clientId); Assert.Equal(newSubscriptions[0].IsCallback, newSubscriptionData.Callback); Assert.Equal(newSubscriptions[0].TransportType.ToString(), newSubscriptionData.SendBy); Assert.Equal(newSubscriptions[0].ExpiryDate, newSubscriptionData.ExpiryDate); } }