Exemplo n.º 1
0
        public async Task UpdateSuite_WhenFieldMoreThanMaxLengthValue_ShouldReturnBadRequest(
            string serializedSuite, string typeOfError)
        {
            //Arrange
            SetAuthorization();

            var projectModel = ProjectFactory.GetProjectModel();
            var suiteModel   = SuiteFactory.GetSuiteModel();

            var project = await ProjectService.AddProject(projectModel);

            var projectId = ProjectSteps.GetProjectId(project);

            var suite = await SuiteService.AddSuite(projectId, suiteModel);

            var suiteId          = SuiteSteps.GetSuiteId(suite);
            var updateSuiteModel = NewtonsoftJsonSerializer.DefaultDeserialize <RequestSuiteModel>(serializedSuite);

            //Act
            var response = await SuiteService.UpdateSuite(suiteId, updateSuiteModel);

            //Assert
            response.StatusCode.Should().Be(HttpStatusCode.BadRequest);

            var errorResponse = response.GetErrors();

            ErrorAssert.ValidateErrorMessage(errorResponse, typeOfError);
        }
Exemplo n.º 2
0
        public async Task AddProject_WhenRequiredFieldHasIncorrectData_ShouldReturnBadRequest(
            string serializedProject, string typeOfError)
        {
            //Arrange
            SetAuthorization();

            //Act
            var projectModel = NewtonsoftJsonSerializer.DefaultDeserialize <RequestProjectModel>(serializedProject);
            var response     = await ProjectService.AddProject(projectModel);

            //Assert
            response.StatusCode.Should().Be(HttpStatusCode.BadRequest);

            var errorResponse = response.GetErrors();

            ErrorAssert.ValidateErrorMessage(errorResponse, typeOfError);
        }
Exemplo n.º 3
0
        public async Task AddSuite_WhenRequiredFieldHasIncorrectValue_ShouldReturnBadRequest(string serializedProject,
                                                                                             string typeOfError)
        {
            //Arrange
            SetAuthorization();

            var projectModel = ProjectFactory.GetProjectModel();
            var project      = await ProjectService.AddProject(projectModel);

            var projectId  = ProjectSteps.GetProjectId(project);
            var suiteModel = NewtonsoftJsonSerializer.DefaultDeserialize <RequestSuiteModel>(serializedProject);

            //Act
            var response = await SuiteService.AddSuite(projectId, suiteModel);

            //Assert
            response.StatusCode.Should().Be(HttpStatusCode.BadRequest);

            var responseMessage = response.GetErrors();

            ErrorAssert.ValidateErrorMessage(responseMessage, typeOfError);
        }