private IActionResult PostSimpleRequestion(ProjectTestController controller) { return(controller.Post(new ProjectTestViewModel() { ProjectId = 1, SeleniumCommands = new List <SeleniumCommand>() { new SeleniumCommand() { OperationId = 1, Values = new string[] { "test" }, WebDriverOperationType = WebDriverOperationType.BrowserNavigationOperation } } })); }
public void ProjectOrNotBelongToUserNotExist() { var options = new DbContextOptionsBuilder <TestingCenterDbContext>() .UseInMemoryDatabase(databaseName: "Add_writes_to_database") .Options; context = new TestingCenterDbContext(options); TestInfoRepository testInfoRepository = new TestInfoRepository(context); var userHelper = new Mock <IUserHelper>(); var unitOfWork = new Mock <IUnitOfWork>(); var projectRepository = new Mock <IProjectRepository>(); projectRepository.Setup(x => x.GetProjectByUser(It.IsAny <string>(), It.IsAny <int>())).Returns(() => null); var projectTestController = new ProjectTestController(testInfoRepository, projectRepository.Object, unitOfWork.Object, userHelper.Object); var respose = PostSimpleRequestion(projectTestController); // Project not exist return 400 Assert.IsType <BadRequestResult>(respose); }