示例#1
0
        public void PostRequestBadRequest()
        {
            // Arrange
            var mockLogger  = new Mock <ILogger>();
            var studentCore = new StudentCore(mockLogger.Object);
            var controller  = new StudentGroupsController(mockLogger.Object, studentCore);

            String[,] input = null;

            // Act
            var output = controller.Post(input);

            // Assert
            Assert.IsInstanceOfType(output, typeof(BadRequestResult));
        }
示例#2
0
        public void PostRequestMultipleGroups()
        {
            // Arrange
            var mockLogger  = new Mock <ILogger>();
            var studentCore = new StudentCore(mockLogger.Object);
            var controller  = new StudentGroupsController(mockLogger.Object, studentCore);

            var input = new String[, ] {
                { "", "Paul", "" }, { "Fred", "", "" }, { "", "", "John" }
            };
            var expected = new string[, ] {
                { "Paul", "Fred" }, { "John", "" }
            };

            // Act
            var actual = controller.Post(input);

            // Assert
            CollectionAssert.AreEqual(expected, actual);
        }