public void Test_that_executes_action_twice_when_is_used_wrong_connection_string() { // Arrange var mi = MockInfo <TestEntity, bool> .CreateForResult(x => x.RecordExists(It.IsAny <TestEntity>())); var m = mi.CreateMockForSequence(MockConfig.WrongConnectionString); var tableStorage = new ReloadingConnectionStringOnFailureAzureTableStorageDecorator <TestEntity>(_ => Task.FromResult(m.Object)); // Act - Assert Assert.ThrowsException <StorageException>(() => tableStorage.RecordExists(It.IsAny <TestEntity>())); m.Verify(foo => foo.RecordExists(It.IsAny <TestEntity>()), Times.Exactly(2)); }
public void Test_that_executes_action_once_when_is_used_good_connection_string() { // Arrange var mi = MockInfo <TestEntity, bool> .CreateForResult(x => x.RecordExists(It.IsAny <TestEntity>())); var m = mi.CreateMockForSequence(MockConfig.GoodConnectionString); var tableStorage = new ReloadingConnectionStringOnFailureAzureTableStorageDecorator <TestEntity>(_ => Task.FromResult(m.Object)); // Act tableStorage.RecordExists(It.IsAny <TestEntity>()); // Assert m.Verify(foo => foo.RecordExists(It.IsAny <TestEntity>()), Times.Once); }