public void Validate_When_Current_question_is_empty_Then_InvalidOperationException()
        {
            // arrange
            SimpleMemoryTrainer target = CreateSimpleMemoryTrainer("q", "a");

            // act
            Assert.Throws <InvalidOperationException>(() => target.Validate("a"));
        }
        public void GetQuestion_When_Current_question_is_empty_storage_is_empty_Then_InvalidOperationException()
        {
            // arrange
            SimpleMemoryTrainer target = CreateSimpleMemoryTrainer();

            // act
            Assert.Throws <InvalidOperationException>(() => target.PickQuestion());
        }
        public void GetQuestion_When_Current_question_is_empty_Then_Qestion_text_is_returned()
        {
            // arrange
            SimpleMemoryTrainer target = CreateSimpleMemoryTrainer("q", "a");

            // act
            target.PickQuestion();

            // assert
            Assert.That(target.CurrentQuestion.Question, Is.EqualTo("q"));
        }
        public void IsQuestionsAvalible_When_storage_is_not_empty_Then_True_is_returned()
        {
            // arrange
            SimpleMemoryTrainer target = CreateSimpleMemoryTrainer("q", "q");

            // act
            var result = target.IsQuestionsAvalible();

            // assert
            Assert.That(result, Is.EqualTo(true));
        }
        public void IsQuestionsAvalible_When_StorageIsEmpty_Then_False_is_returned()
        {
            // arrange
            SimpleMemoryTrainer target = CreateSimpleMemoryTrainer();

            // act
            var result = target.IsQuestionsAvalible();

            // assert
            Assert.That(result, Is.EqualTo(false));
        }
Exemplo n.º 6
0
        public HomeScreen(IDictionaryStorage store)
            : base()
        {
            this.store = store;
            this.store.SotrageChanged += (e, s) => {
                this.InvokeOnMainThread(PopulateTable);
            };
            this.trainer = new SimpleMemoryTrainer(this.store);

            Initialize();
        }
        public void Clear_When_current_question_is_present_Then_current_question_is_reset()
        {
            // arrange
            SimpleMemoryTrainer target = CreateSimpleMemoryTrainer("q", "a");

            target.PickQuestion();
            // act
            target.Clear();

            // assert
            Assert.That(target.CurrentQuestion, Is.EqualTo(null));
        }
        public void Validate_When_Answer_is_incorrect_Then_True_is_returned_record_is_marked_as_Success()
        {
            // arrange
            var storageMock            = new Mock <IMemoryStorage>();
            SimpleMemoryTrainer target = CreateSimpleMemoryTrainer(storageMock.Object, "q", "a");

            target.PickQuestion();
            // act
            var result = target.Validate("c");

            // assert
            Assert.That(result, Is.EqualTo(false));
            storageMock.Verify(x => x.ItemFail(It.IsAny <Guid>()), Times.Once());
        }
Exemplo n.º 9
0
        public AnswerController(IDictionaryStorage store) : base()
        {
            this.trainer                = new SimpleMemoryTrainer(store);
            tfAnswer                    = new UITextField();
            tfAnswer.ReturnKeyType      = UIReturnKeyType.Done;
            tfAnswer.BorderStyle        = UITextBorderStyle.RoundedRect;
            tfAnswer.ClearButtonMode    = UITextFieldViewMode.WhileEditing;
            tfAnswer.VerticalAlignment  = UIControlContentVerticalAlignment.Center;
            tfAnswer.AutocorrectionType = UITextAutocorrectionType.No;

            lblQuestion = new UILabel();
            lblQuestion.TextAlignment = UITextAlignment.Center;
            //lblQuestion.Lines = 0;
            lblQuestion.LineBreakMode = UILineBreakMode.WordWrap;
            lblQuestion.Font          = UIFont.BoldSystemFontOfSize(UIFont.LabelFontSize);
        }