public async Task WhenExecutingBasicStateActionsThenFlowCompletesSuccesfully()
        {
            EmulationStateRepository stateRepository = new EmulationStateRepository(TestDetectorId, StatesDirectory);

            var originalState = new TestState
            {
                Field1 = "testdata",
                Field2 = new List <DateTime> {
                    new DateTime(2018, 02, 15)
                },
                Field3 = true
            };

            await stateRepository.StoreStateAsync("key", originalState, CancellationToken.None);

            var retrievedState = await stateRepository.GetStateAsync <TestState>("key", CancellationToken.None);

            // Validate
            Assert.AreEqual(originalState.Field1, retrievedState.Field1);
            CollectionAssert.AreEquivalent(originalState.Field2, retrievedState.Field2);
            Assert.AreEqual(originalState.Field3, retrievedState.Field3);
            Assert.AreEqual(originalState.Field4, retrievedState.Field4);

            // Update existing state
            var updatedState = new TestState
            {
                Field1 = null,
                Field2 = new List <DateTime> {
                    new DateTime(2018, 02, 15)
                },
                Field3 = true
            };

            await stateRepository.StoreStateAsync("key", updatedState, CancellationToken.None);

            retrievedState = await stateRepository.GetStateAsync <TestState>("key", CancellationToken.None);

            // Validate
            Assert.AreEqual(updatedState.Field1, retrievedState.Field1);
            CollectionAssert.AreEquivalent(updatedState.Field2, retrievedState.Field2);
            Assert.AreEqual(updatedState.Field3, retrievedState.Field3);
            Assert.AreEqual(updatedState.Field4, retrievedState.Field4);

            await stateRepository.StoreStateAsync("key2", originalState, CancellationToken.None);

            await stateRepository.DeleteStateAsync("key", CancellationToken.None);

            retrievedState = await stateRepository.GetStateAsync <TestState>("key", CancellationToken.None);

            Assert.IsNull(retrievedState);

            retrievedState = await stateRepository.GetStateAsync <TestState>("key2", CancellationToken.None);

            Assert.IsNotNull(retrievedState);
        }
        private static async Task SimulateDetectorRun(string key)
        {
            var stateRepo = new EmulationStateRepository(TestDetectorId, StatesDirectory);

            var state = new List <int> {
                5, 10
            };

            await stateRepo.StoreStateAsync(key, state, CancellationToken.None);

            await stateRepo.GetStateAsync <List <int> >(key, CancellationToken.None);

            await stateRepo.StoreStateAsync(key, state, CancellationToken.None);

            await stateRepo.GetStateAsync <List <int> >(key, CancellationToken.None);

            await stateRepo.DeleteStateAsync(key, CancellationToken.None);

            await stateRepo.GetStateAsync <List <int> >(key, CancellationToken.None);
        }