public async void TryInvokeFromCacheAsync_WithTypeParameter_CreatesInvocationRequestAndCallsTryInvokeCoreAsync()
        {
            // Arrange
            const int             dummyResult = 1;
            const string          dummyModuleCacheIdentifier = "dummyModuleCacheIdentifier";
            const string          dummyExportName            = "dummyExportName";
            var                   dummyArgs = new object[0];
            var                   dummyCancellationToken = new CancellationToken();
            Mock <INodeJSService> mockNodeJSService      = _mockRepository.Create <INodeJSService>();

            mockNodeJSService.
            Setup(t => t.TryInvokeFromCacheAsync <int>(dummyModuleCacheIdentifier, dummyExportName, dummyArgs, dummyCancellationToken)).
            ReturnsAsync((true, dummyResult));
            var dummyServices = new ServiceCollection();

            dummyServices.AddSingleton(typeof(INodeJSService), mockNodeJSService.Object);
            StaticNodeJSService.SetServices(dummyServices);

            // Act
            (bool success, int result) = await StaticNodeJSService.TryInvokeFromCacheAsync <int>(dummyModuleCacheIdentifier, dummyExportName, dummyArgs, dummyCancellationToken).ConfigureAwait(false);

            // Assert
            Assert.True(success);
            Assert.Equal(dummyResult, result);
            _mockRepository.VerifyAll();
        }
        public async void TryInvokeFromCacheAsync_ReturnsFalseIfModuleIsNotCached()
        {
            // Arrange
            const string dummyResultString    = "success";
            const string dummyCacheIdentifier = "dummyCacheIdentifier";

            // Act
            (bool success, DummyResult value) = await StaticNodeJSService.TryInvokeFromCacheAsync <DummyResult>(dummyCacheIdentifier, args : new[] { dummyResultString }).ConfigureAwait(false);

            // Assert
            Assert.False(success);
            Assert.Null(value);
        }
        public async void TryInvokeFromCacheAsync_InvokesJavascriptIfModuleIsCached()
        {
            // Arrange
            const string dummyResultString    = "success";
            const string dummyCacheIdentifier = "dummyCacheIdentifier";

            // Cache
            await StaticNodeJSService.
            InvokeFromStringAsync <DummyResult>("module.exports = (callback, resultString) => callback(null, {result: resultString});",
                                                dummyCacheIdentifier,
                                                args : new[] { dummyResultString }).
            ConfigureAwait(false);

            // Act
            (bool success, DummyResult value) = await StaticNodeJSService.TryInvokeFromCacheAsync <DummyResult>(dummyCacheIdentifier, args : new[] { dummyResultString }).ConfigureAwait(false);

            // Assert
            Assert.True(success);
            Assert.Equal(dummyResultString, value.Result);
        }