public override ISubscriptionStore GetSubscriptionStore()
            {
                var store = new AzureTableSubscriptionStore();

                store.Clear();
                return(store);
            }
            public void WhenConnectionStringWithNoSettings_ThenReturnsDefault()
            {
                store = new AzureTableSubscriptionStore();

                var result = store.ConnectionString;

                Assert.That(result, Is.EqualTo(AzureStorage.AzureEmulatorConnectionString));
            }
            public void WhenCtorWithNoSetting_ThenInitializes()
            {
                store = new AzureTableSubscriptionStore();

                Assert.That(store.SubscriptionTableName, Is.EqualTo(AzureTableSubscriptionStore.DefaultSubscriptionTableName));
                Assert.That(store.DeliveryResultsTableName, Is.EqualTo(AzureTableSubscriptionStore.DefaultDeliveryResultsTableName));
                Assert.That(store.ConnectionString, Is.EqualTo(AzureStorage.AzureEmulatorConnectionString));
            }
            public void WhenConnectionStringWithSettings_ThenReturnsSetting()
            {
                var settings = new Mock <IAppSettings>();

                settings.Setup(s => s.Get(AzureTableSubscriptionStore.AzureConnectionStringSettingName, AzureStorage.AzureEmulatorConnectionString))
                .Returns("aconnectionstring");
                store = new AzureTableSubscriptionStore(settings.Object);

                var result = store.ConnectionString;

                Assert.That(result, Is.EqualTo("aconnectionstring"));
                settings.Verify(s => s.Get(AzureTableSubscriptionStore.AzureConnectionStringSettingName, AzureStorage.AzureEmulatorConnectionString));
            }
 public void Initialize()
 {
     subscriptionStorage = new Mock <IAzureTableStorage <WebhookSubscriptionEntity> >();
     subscriptionStorage.Setup(ss => ss.Find(It.IsAny <TableStorageQuery>()))
     .Returns(new List <WebhookSubscriptionEntity>());
     deliveryResultStorage = new Mock <IAzureTableStorage <SubscriptionDeliveryResultEntity> >();
     deliveryResultStorage.Setup(ss => ss.Find(It.IsAny <TableStorageQuery>()))
     .Returns(new List <SubscriptionDeliveryResultEntity>());
     store = new AzureTableSubscriptionStore
     {
         SubscriptionStorage    = subscriptionStorage.Object,
         DeliveryResultsStorage = deliveryResultStorage.Object
     };
 }
            public void WhenCtorWithSettings_ThenInitializesFromSettings()
            {
                var appSettings = new Mock <IAppSettings>();

                appSettings.Setup(settings => settings.Get(AzureTableSubscriptionStore.AzureConnectionStringSettingName, It.IsAny <string>()))
                .Returns("aconnectionstring");
                appSettings.Setup(settings => settings.Get(AzureTableSubscriptionStore.SubscriptionTableNameSettingName, It.IsAny <string>()))
                .Returns("atablename1");
                appSettings.Setup(settings => settings.Get(AzureTableSubscriptionStore.DeliveryResultsTableNameSettingName, It.IsAny <string>()))
                .Returns("atablename2");

                store = new AzureTableSubscriptionStore(appSettings.Object);

                Assert.That(store.SubscriptionTableName, Is.EqualTo("atablename1"));
                Assert.That(store.DeliveryResultsTableName, Is.EqualTo("atablename2"));
                Assert.That(store.ConnectionString, Is.EqualTo("aconnectionstring"));
            }