示例#1
0
        public async Task MissingKeyThrowsException()
        {
            var store = new DictionaryLocaleSpeechStore();

            store.AddLanguage("fr", new Dictionary <string, object> {
            });
            await Assert.ThrowsAsync <KeyNotFoundException>(() => store.Get("fr", "test", null));
        }
示例#2
0
        public async Task KeyWithParamsGeneratesSpeech()
        {
            var testText = "yes - a {0} test";
            var store    = new DictionaryLocaleSpeechStore();

            store.AddLanguage("fr", new Dictionary <string, object>
            {
                { "test", testText }
            });

            var result = await store.Get("fr", "test", new object[] { "simple" });

            Assert.IsType <PlainTextOutputSpeech>(result);
            Assert.Equal("yes - a simple test", ((PlainTextOutputSpeech)result).Text);
        }