コード例 #1
0
        public async Task RequiredFieldTesting()
        {
            var obj = new RegisterStudentInfoCommand
            {
                FirstName = string.Empty,
                LastName  = "Student",
                DOB       = DateTime.Parse("1985-11-30"),
                Email     = string.Empty
            };

            var resp = await _registerStudentInfoCommandHandler.Handle(obj);

            Assert.AreEqual(false, resp.IsSuccessful);

            Assert.AreEqual(State.unProcessableEntity, resp.Status);
        }
コード例 #2
0
        public async Task InvalidEmailTesting()
        {
            var obj = new RegisterStudentInfoCommand
            {
                FirstName = "Test",
                LastName  = "Student",
                DOB       = DateTime.Parse("1985-11-30"),
                Email     = "TestStudentsdfsd"
            };

            var resp = await _registerStudentInfoCommandHandler.Handle(obj);

            Assert.AreEqual(false, resp.IsSuccessful);

            Assert.AreEqual(State.unProcessableEntity, resp.Status);
        }
コード例 #3
0
        public async Task RegisterStudentTesting()
        {
            var obj = new RegisterStudentInfoCommand
            {
                FirstName = "Test",
                LastName  = "Student",
                DOB       = DateTime.Parse("1985-11-30"),
                Email     = "*****@*****.**"
            };

            var resp = await _registerStudentInfoCommandHandler.Handle(obj);

            Assert.AreEqual(true, resp.IsSuccessful);

            Assert.IsInstanceOfType(resp.ResponseMessage, typeof(Student));
        }
コード例 #4
0
        public async Task RegisterStudentWithInvalidDOBTesting()
        {
            var obj = new RegisterStudentInfoCommand
            {
                FirstName = "Test",
                LastName  = "Student",
                DOB       = DateTime.MinValue,
                Email     = "*****@*****.**"
            };

            var resp = await _registerStudentInfoCommandHandler.Handle(obj);

            Assert.AreEqual(false, resp.IsSuccessful);

            Assert.AreEqual(State.unProcessableEntity, resp.Status);
        }
コード例 #5
0
        public async Task MaxLengthofstringTesting()
        {
            var obj = new RegisterStudentInfoCommand
            {
                FirstName = "Test",
                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 ",
                DOB   = DateTime.Parse("1985-11-30"),
                Email = "*****@*****.**"
            };

            var resp = await _registerStudentInfoCommandHandler.Handle(obj);

            Assert.AreEqual(false, resp.IsSuccessful);

            Assert.AreEqual(State.unProcessableEntity, resp.Status);

            StringAssert.EndsWith(resp.ResponseMessage, "50.");
        }