Inheritance: IQuestionFormRepository
示例#1
0
        public void GetPreviousForm_returns_null_when_at_first_position()
        {
            Form form1 = new Form {Name = "Form1"};

            var repository = new FormRepository(mSession);

            repository.Insert(form1);

            var previous = repository.GetPreviousForm(form1.Id);

            Assert.IsNull(previous);
        }
示例#2
0
        public void HasNext()
        {
            Form form1 = new Form { Name = "Form1" };
            Form form2 = new Form { Name = "Form2" };

            var repository = new FormRepository(mSession);

            repository.Insert(form1);
            repository.Insert(form2);

            Assert.IsTrue(repository.HasNext(form1.Id));
        }
示例#3
0
        public void GetNextForm_returns_null_when_at_last_index()
        {
            Form form1 = new Form { Name = "Form1" };

            var repository = new FormRepository(mSession);

            repository.Insert(form1);

            var next = repository.GetNextForm(form1.Id);

            Assert.IsNull(next);
        }
示例#4
0
        public void GetPrevious()
        {
            Form form1 = new Form{ Name = "Form1"};
            Form form2 = new Form{ Name = "Form2"};

            var repository = new FormRepository(mSession);

            repository.Insert(form1);
            repository.Insert(form2);

            var previous = repository.GetPreviousForm(form2.Id);

            Assert.AreEqual(form1.Name, previous.Name);
        }
示例#5
0
        public void GetNext()
        {
            Form form1 = new Form { Name = "Form1" };
            Form form2 = new Form { Name = "Form2" };

            var repository = new FormRepository(mSession);

            repository.Insert(form1);
            repository.Insert(form2);

            var next = repository.GetNextForm(form1.Id);

            Assert.AreEqual(form2.Name, next.Name);
        }
示例#6
0
 public AllFormsViewModel(FormRepository formRepository)
 {
     mFormRepository = formRepository;
     Forms = new ObservableCollection<QuestionFormViewModel>();
 }
示例#7
0
        public void HasNext_and_returns_false_if_none_exists()
        {
            Form form1 = new Form { Name = "Form1" };
            Form form2 = new Form { Name = "Form2" };

            var repository = new FormRepository(mSession);

            repository.Insert(form1);
            repository.Insert(form2);

            Assert.IsFalse(repository.HasNext(form2.Id));
        }
示例#8
0
        public void HasPrevious_should_return_false_if_no_form_exists_yet()
        {
            var repository = new FormRepository(mSession);

            Assert.IsFalse(repository.HasPrevious(1));
        }
示例#9
0
        public void HasPrevious_should_return_false_if_it_is_the_first_form()
        {
            Form form1 = new Form { Name = "Form1" };
            Form form2 = new Form { Name = "Form2" };

            var repository = new FormRepository(mSession);

            repository.Insert(form1);
            repository.Insert(form2);

            Assert.IsFalse(repository.HasPrevious(form1.Id));
        }