Example #1
0
        public async Task ModifyStudentDetailsTest()
        {
            var obj = new EditStudentInfoCommand
            {
                StudentId = 1,
                LastName  = "Test User"
            };

            var res = await _editStudentInfoCommandHandler.Handle(obj) as Results;

            Assert.AreEqual(true, res.IsSuccessful);
        }
Example #2
0
        public async Task TestEditStudentInfoCommandPassingInvalidStudentId()
        {
            var obj = new EditStudentInfoCommand
            {
                StudentId = 235,
                LastName  = "Invalid student"
            };

            var res = await _editStudentInfoCommandHandler.Handle(obj) as Results;

            Assert.AreEqual(false, res.IsSuccessful);

            StringAssert.Contains(res.ResponseMessage, "Student not found");

            Assert.AreEqual(State.notFound, res.Status);
        }
Example #3
0
        public async Task TestValidationOfCommandObject()
        {
            var obj = new EditStudentInfoCommand
            {
                StudentId = 1,
                LastName  = "this is lot of text to make bad request this is lot of text to make bad request " +
                            "this is lot of text to make bad request this is lot of text to make bad request this is lot of text to make bad request " +
                            "this is lot of text to make bad request this is lot of text to make bad request this is lot of text to make bad request " +
                            "this is lot of text to make bad request this is lot of text to make bad request this is lot of text to make bad request " +
                            "this is lot of text to make bad request this is lot of text to make bad request this is lot of text to make bad request " +
                            "this is lot of text to make bad request this is lot of text to make bad request this is lot of text to make bad request "
            };

            var res = await _editStudentInfoCommandHandler.Handle(obj) as Results;

            Assert.AreEqual(false, res.IsSuccessful);

            StringAssert.EndsWith(res.ResponseMessage, "50.");

            Assert.AreEqual(State.unProcessableEntity, res.Status);
        }