Beispiel #1
0
        public static ILocaleSpeech SetupLanguages(SkillRequest skillRequest)
        {
            var store = new DictionaryLocaleSpeechStore();

            store.AddLanguage("en", new Dictionary <string, object>
            {
                { "WELCOME", "Welcome to the my demo skill" },
                { "THANK_YOU_INTENT", "You are welcome!" },
                { "GENERATE_NUMBER", "The next random number is {0}" },
                { "AMAZON.HelpIntent", "Ask me to generate a random number" },
                { "AMAZON.CancelIntent", "I'm stopping the request" },
                { "AMAZON.StopIntent", "Bye bye" }
            });


            store.AddLanguage("it", new Dictionary <string, object>
            {
                { "WELCOME", "Benvenuto nello skill di prova" },
                { "THANK_YOU_INTENT", "Prego" },
                { "GENERATE_NUMBER", "Il prossimo numero random è {0}" },
                { "AMAZON.HelpIntent", "Puoi chiedermi di generarti un numero random" },
                { "AMAZON.CancelIntent", "Sto interrompendo la richiesta" },
                { "AMAZON.StopIntent", "Ciao e grazie" }
            });

            var localeSpeechFactory = new LocaleSpeechFactory(store);
            var locale = localeSpeechFactory.Create(skillRequest);

            return(locale);
        }
        public static ILocaleSpeech CreateLocale(this SkillRequest skillRequest, DictionaryLocaleSpeechStore store)
        {
            var localeSpeechFactory = new LocaleSpeechFactory(store);
            var locale = localeSpeechFactory.Create(skillRequest);

            return(locale);
        }
        public void ArgumentThrowsWithNullLocale()
        {
            var store   = Substitute.For <ILocaleSpeechStore>();
            var factory = new LocaleSpeechFactory(store);

            Assert.Throws <ArgumentNullException>(() => factory.Create((string)null));
        }
Beispiel #4
0
        public static ILocaleSpeech SetupLanguages(SkillRequest skillRequest)
        {
            var store = new DictionaryLocaleSpeechStore();

            store.AddLanguage("en", new Dictionary <string, object>
            {
                { "Welcome", "Welcome to the AppConsult skill!" },
                { "LastPosts", "The title of the last article is {0}" },
                { "Cancel", "I'm cancelling the request..." },
                { "Help", "You can ask me, for example, which is the last article." },
                { "Stop", "Goodbye!" }
            });

            store.AddLanguage("it", new Dictionary <string, object>
            {
                { "Welcome", "Benvenuti in Windows AppConsult!" },
                { "LastPosts", "Il titolo dell'ultimo articolo è {0}" },
                { "Cancel", "Sto annullando la richiesta..." },
                { "Help", "Puoi chiedermi, ad esempio, qual è l'ultimo articolo. " },
                { "Stop", "Alla prossima!" }
            });


            var localeSpeechFactory = new LocaleSpeechFactory(store);
            var locale = localeSpeechFactory.Create(skillRequest);

            return(locale);
        }
        public void ArgumentThrowsClientWithNullSkillRequest()
        {
            var store   = Substitute.For <ILocaleSpeechStore>();
            var factory = new LocaleSpeechFactory(store);

            Assert.Throws <ArgumentNullException>(() => { factory.Create((SkillRequest)null); });
        }
        public void ArgumentThrowsWithNoMatchingStore()
        {
            var store = Substitute.For <ILocaleSpeechStore>();

            store.Supports(Arg.Any <string>()).Returns(false);
            var factory = new LocaleSpeechFactory(store);

            Assert.Throws <InvalidOperationException>(() => factory.Create("en-GB"));
        }
        public void CreatesClientWithMatchingStore()
        {
            var store = Substitute.For <ILocaleSpeechStore>();

            store.Supports(Arg.Any <string>()).Returns(true);
            var factory = new LocaleSpeechFactory(store);
            var client  = (Alexa.NET.LocaleSpeech.LocaleSpeech)factory.Create("en-GB");

            Assert.Equal(store, client.Store);
            Assert.Equal("en-GB", client.Locale);
        }
        public void SupportChecksForGeneralIfSpecificFound()
        {
            var store = Substitute.For <ILocaleSpeechStore>();

            store.Supports("en-GB").Returns(false);
            store.Supports("en").Returns(true);
            var factory = new LocaleSpeechFactory(store);
            var result  = factory.Create("en-GB");

            Assert.NotNull(result);
        }
Beispiel #9
0
        public static ILocaleSpeech SetupLanguages(SkillRequest skillRequest)
        {
            var store = new DictionaryLocaleSpeechStore();

            store.AddLanguage("en", new Dictionary <string, object>
            {
                { "Welcome", "Welcome to the Sample skill!" },
                { "Stop", "Goodbye!" }
            });


            var localeSpeechFactory = new LocaleSpeechFactory(store);
            var locale = localeSpeechFactory.Create(skillRequest);

            return(locale);
        }
Beispiel #10
0
        public static ILocaleSpeech SetupLanguages(SkillRequest skillRequest)
        {
            var store = new DictionaryLocaleSpeechStore();

            store.AddLanguage("en", new Dictionary <string, object>
            {
                { "Welcome", "Welcome to the NetCoreConf skill! I'm sorry to inform you that Carlos does not speak catalan" },
                { "event", "OK I'm sending the event to Event Grid" },
                { "Cancel", "I'm cancelling the request..." },
                { "Help", "Sorry you are on your own." },
                { "Stop", "Bye!" }
            });

            var localeSpeechFactory = new LocaleSpeechFactory(store);
            var locale = localeSpeechFactory.Create(skillRequest);

            return(locale);
        }
Beispiel #11
0
        public static ILocaleSpeech SetupLanguages(SkillRequest skillRequest)
        {
            var store = new DictionaryLocaleSpeechStore();

            store.AddLanguage("en", new Dictionary <string, object>
            {
                { "Welcome", "Welcome to the Alimentatech skill! I'm sorry to inform you that I will not be paying for the beers after the event" },
                { "carlos", "Wait. I'm getting his bitcoin balance.... Hmmmmmm Carlos you should pay at least for your beers!!!" },
                { "event", "OK I'm sending the event to Event Grid" },
                { "Cancel", "I'm cancelling the request..." },
                { "Help", "Sorry you are on your own." },
                { "Stop", "Bye!" }
            });

            var localeSpeechFactory = new LocaleSpeechFactory(store);
            var locale = localeSpeechFactory.Create(skillRequest);

            return(locale);
        }