Exemple #1
0
        public void GetAllForProgram()
        {
            // Arrange
            var controller = new FormsController(InitRepo());

            // Act
            var forms = controller.Get(1);

            // Assert
            Assert.IsNotNull(forms);
            Assert.AreEqual(2, forms.Count());
        }
Exemple #2
0
        public void TestNoLanguage()
        {
            // Arrange
            var controller = new FormsController(InitRepo());

            // Act
            var form = controller.Get(1, 1);

            // Assert
            Assert.IsNull(form.Label);
            Assert.AreEqual(2, form.Labels.Count());
        }
Exemple #3
0
        public void TestFrench()
        {
            // Arrange
            var controller = new FormsController(InitRepo());

            controller.SetHeaders(new Dictionary <string, string>
            {
                { "ACCEPT-LANGUAGE", "fr" }
            });

            // Act
            var form = controller.Get(1, 1);

            // Assert
            Assert.AreEqual(form.Label, "Test fr");
            Assert.IsNull(form.Labels);
        }
Exemple #4
0
        public void GetOne()
        {
            // Arrange
            var controller = new FormsController(InitRepo());

            controller.SetHeaders(new Dictionary <string, string>
            {
                { "ACCEPT-LANGUAGE", "en" }
            });

            // Act
            var form = controller.Get(1, 2);

            // Assert
            Assert.IsNotNull(form);
            Assert.AreEqual(form.Label, "Form 2");
            Assert.IsNotNull(form.Sections);
            Assert.AreEqual(3, form.Sections.Count);
        }