Esempio n. 1
0
        public async Task GetRandomWordAsync_ReturnsNullIfNone()
        {
            var service = new WordsService(_context);
            var actual  = await service.GetRandomWordAsync <Adverb>("en");

            Assert.Null(actual);
        }
Esempio n. 2
0
        public async Task GetRandomWordAsync_WithVulgarFilter_ReturnsNullWhenNoneInLanguage()
        {
            await FeedTestData(_context, 3);

            var service = new WordsService(_context);
            var actual  = await service.GetRandomWordAsync <Adjective>("pl", useVulgar : true);

            Assert.Null(actual);
        }
Esempio n. 3
0
        public async Task GetRandomWordAsync_WithVulgarFilter_ReturnsNullIfNone()
        {
            await FeedTestData(_context, 1);

            var service = new WordsService(_context);
            var actual  = await service.GetRandomWordAsync <Adverb>("en", useVulgar : true);

            Assert.Null(actual);
        }
Esempio n. 4
0
        public async Task GetRandomWordAsync_ReturnsWordIfAny()
        {
            await FeedTestData(_context, 3);

            var service = new WordsService(_context);
            var actual  = await service.GetRandomWordAsync <Noun>("en");

            Assert.NotNull(actual);
            Assert.IsType <Noun>(actual);
        }
Esempio n. 5
0
        public async Task GetRandomWordAsync_WithVulgarFilter_ReturnsWordIfAny()
        {
            await FeedTestData(_context, 3);

            var service = new WordsService(_context);
            var actual  = await service.GetRandomWordAsync <Noun>("en", useVulgar : true);

            Assert.NotNull(actual);
            Assert.IsType <Noun>(actual);
            Assert.True(actual.IsVulgar);
        }