示例#1
0
        public QuestionDeck()
        {
            var pop = new CategoryQuestions("Pop");

            pop.PlacedOn(new[] { 0, 4, 8 });

            var science = new CategoryQuestions("Science");

            science.PlacedOn(new[] { 1, 5, 9 });

            var sports = new CategoryQuestions("Sports");

            sports.PlacedOn(new[] { 2, 6, 10 });

            var rock = new CategoryQuestions("Rock");

            rock.PlacedOn(new[] { 3, 7, 11 });

            categories = new List <CategoryQuestions>
            {
                pop,
                science,
                sports,
                rock
            };
        }
示例#2
0
        public void NotPlacedOnAskedPosition()
        {
            var categoryQuestions = new CategoryQuestions("anything");

            categoryQuestions.PlacedOn(new[] { 5, 9 });
            Assert.False(categoryQuestions.IsPlacedOn(6));
        }
示例#3
0
        public void PlacedOnAskedPosition()
        {
            var categoryQuestions = new CategoryQuestions("anything");

            categoryQuestions.PlacedOn(new[] { 5, 9 });
            Assert.True(categoryQuestions.IsPlacedOn(5));
            Assert.True(categoryQuestions.IsPlacedOn(9));
        }
示例#4
0
        public void AskManyQuestions()
        {
            var categoryQuestions = new CategoryQuestions("anything");

            categoryQuestions.AddQuestion("first");
            categoryQuestions.AddQuestion("second");
            Assert.Equal("first", categoryQuestions.NextQuestion());
            Assert.Equal("second", categoryQuestions.NextQuestion());
        }
示例#5
0
        public void AskTooManyQuestions()
        {
            var categoryQuestions = new CategoryQuestions("anything");

            categoryQuestions.AddQuestion("first");
            categoryQuestions.NextQuestion();

            var ex = Record.Exception(() => categoryQuestions.NextQuestion());

            Assert.IsType <InvalidOperationException>(ex);
            Assert.Contains("out of questions", ex.Message, StringComparison.InvariantCultureIgnoreCase);
        }
示例#6
0
        public void ExposeName()
        {
            var categoryQuestions = new CategoryQuestions("my name");

            Assert.Equal("my name", categoryQuestions.Name);
        }