Exemplo n.º 1
0
        public void AddTraining_EndDateEmpty()
        {
            var model = new TrainingModel
            {
                TrainingName      = ".net advanced",
                TrainingStartDate = DateTime.Now.ToString()
            };
            var trainingServiceMock = new Mock <ITrainingService>();

            trainingServiceMock.Setup(service => service.AddTrainingDetails(model));

            var controller = new TrainingController(trainingServiceMock.Object);

            controller.Request       = new HttpRequestMessage();
            controller.Configuration = new HttpConfiguration();
            controller.Validate(model);

            var actualResult = controller.AddTraining(model);

            Assert.AreEqual(actualResult.StatusCode, HttpStatusCode.BadRequest);
        }