コード例 #1
0
        public async Task Announce_Sentence_WithDifferentRate()
        {
            string sentence = "I would like to have a piece of cheese at the earliest possible moment.";

            using (var announcer = new Announcer())
            {
                await announcer.AnnounceAsync("Using slow speech rate.");

                await announcer.AnnounceAsync(sentence, Announcer.DefaultPitch, 50);
            }

            using (var announcer = new Announcer())
            {
                await announcer.AnnounceAsync("Using normal speech rate.");

                await announcer.AnnounceAsync(sentence, Announcer.DefaultPitch, Announcer.DefaultRate);
            }

            using (var announcer = new Announcer())
            {
                await announcer.AnnounceAsync("Using fast speech rate.");

                await announcer.AnnounceAsync(sentence, Announcer.DefaultPitch, 150);
            }
        }
コード例 #2
0
        public async Task Announce_SingleWord_WithInterval()
        {
            using (var announcer = new Announcer())
            {
                announcer.AnnounceAsync("Activating count down.", 10, 120);
                await Task.Delay(1000);

                for (int i = 0; i < 3; ++i)
                {
                    announcer.AnnounceAsync("Five", -5, 100);
                    await Task.Delay(1000);

                    announcer.AnnounceAsync("Four", -5, 100);
                    await Task.Delay(1000);

                    announcer.AnnounceAsync("three", -5, 100);
                    await Task.Delay(1000);

                    announcer.AnnounceAsync("two", -5, 100);
                    await Task.Delay(1000);

                    announcer.AnnounceAsync("One", -5, 100);
                    await Task.Delay(1000);

                    announcer.AnnounceAsync("Attack", 10, 100);
                    await Task.Delay(1000);

                    announcer.AnnounceAsync("Defence", 10, 100);
                    await Task.Delay(1000);
                }
            }
        }
コード例 #3
0
        public async Task Announce_UsingPitch()
        {
            using (var announcer = new Announcer())
            {
                string word = "Fire in the hole!";

                var highPitch = 10;
                await announcer.AnnounceAsync("Speaking with high pitch");

                await announcer.AnnounceAsync(word, highPitch, Announcer.DefaultRate);

                var lowPitch = -10;
                await announcer.AnnounceAsync("Speaking with low pitch");

                await announcer.AnnounceAsync(word, lowPitch, Announcer.DefaultRate);
            }
        }
コード例 #4
0
        public void AnnounceFakeServerWithCustomServerInfo()
        {
            if (File.Exists("announce-custom.log"))
            {
                File.Delete("announce-custom.log");
            }
            if (File.Exists("announce-error-custom.log"))
            {
                File.Delete("announce-error-custom.log");
            }
            Announcer announcer = Announcer.Create("announce-custom.json", 7777);

            Assert.NotNull(announcer);
            announcer.AnnounceAsync().GetAwaiter().GetResult();
            Assert.True(File.Exists("announce-custom.log"), "No announce logs have been created. Possibly the announcers array is empty.");
            Assert.True(!(File.Exists("announce-error-custom.log")), "There have been errors during requests. Check \"announce-error-custom.log\" for more information.");
        }