예제 #1
0
        public async Task GetDataShouldReturnCachedValue()
        {
            // ARRANGE
            await InitializeFakeDaemon().ConfigureAwait(false);

            // ACT

            DefaultDaemonRxApp.SaveData("GetDataShouldReturnCachedValue_id", "saved data");

            DefaultDaemonRxApp.GetData <string>("GetDataShouldReturnCachedValue_id");

            await RunFakeDaemonUntilTimeout().ConfigureAwait(false);

            // ASSERT
            DefaultDataRepositoryMock.Verify(n => n.Get <string>(It.IsAny <string>()), Times.Never);
            DefaultDataRepositoryMock.Verify(n => n.Save <string>(It.IsAny <string>(), It.IsAny <string>()), Times.Once);
        }
예제 #2
0
        public async Task SavedDataShouldReturnSameDataUsingExpando()
        {
            // ARRANGE
            await InitializeFakeDaemon().ConfigureAwait(false);

            dynamic data = new ExpandoObject();

            data.Item = "Some data";

            // ACT
            DefaultDaemonRxApp.SaveData("data_exists", data);
            var collectedData = DefaultDaemonRxApp.GetData <ExpandoObject>("data_exists");

            await RunFakeDaemonUntilTimeout().ConfigureAwait(false);

            // ASSERT
            Assert.Equal(data, collectedData);
        }