public TestInfoConfigViewModel(ProjectTestConfig projectTestConfig, int testInfoId) { Id = 0; TestInfoId = testInfoId; ConfigProjectTestId = projectTestConfig.ConfigProjectTestId; Value = projectTestConfig.Value; }
public ProjectTestConfigViewModel Convert(ProjectTestConfig projectTestConfig) { Id = projectTestConfig.Id; ProjectId = projectTestConfig.ProjectId; ConfigProjectTestId = projectTestConfig.ConfigProjectTestId; Value = projectTestConfig.Value; return(this); }
public void Post_Config_Not_Found() { var model = new ProjectTestConfig() { Id = 1, ProjectId = 1, Value = "wrongbool", ConfigProjectTestId = 1 }; var projectTestConfigController = GetType(); var reponse = projectTestConfigController.Post(new List <ProjectTestConfigViewModel>() { new ProjectTestConfigViewModel().Convert(model) }); Assert.IsType <BadRequestObjectResult>(reponse); }
public void Post_Incorrect_bool_value() { var model = new ProjectTestConfig() { Id = 1, ProjectId = 1, Value = "wrongbool", ConfigProjectTestId = 1 }; var projectTestConfigController = GetType(); _configProjectTestRepository.Setup(x => x.FindById(It.IsAny <int>())).Returns(new Mock <ConfigProjectTest>().Object); var reponse = projectTestConfigController.Post(new List <ProjectTestConfigViewModel>() { new ProjectTestConfigViewModel().Convert(model) }); Assert.IsType <BadRequestObjectResult>(reponse); }