public void GetByIdReturnsBadRequest() { var publication = PublicationBuilder.New().Build(); var result = controller.Get(publication.Id); Assert.IsType <BadRequestObjectResult>(result.Result); }
public void TestValidationPublication() { var okPublication = PublicationBuilder.New().Build(); var resultValidation = new PublicationValidator().Validate(okPublication); Assert.True(resultValidation.IsValid); }
public void TestValidationPublicationNotExistOnDB() { var badPublication = PublicationBuilder.New().Build(); var resultValidation = new PublicationExistValidator().Validate(badPublication.Id); Assert.False(resultValidation.IsValid); }
public void TestValidationPublicationBadTitle() { var badPublication = PublicationBuilder.New().WithTitle(" ").Build(); var resultValidation = new PublicationValidator().Validate(badPublication); Assert.False(resultValidation.IsValid); }
public void TestGetById() { Publication publication = PublicationBuilder.New().Build(); // Produção através dos métodos new CreatePublication().CreateNewRegister(publication); var idGet = new GetPublication().GetRegisterById(publication.Id); Assert.IsNotNull(idGet); }
public void TestValidationPublicationExistOnDB() { var okPublication = PublicationBuilder.New().Build(); new PublicationRepository().Create(okPublication); var resultValidation = new PublicationExistValidator().Validate(okPublication.Id); Assert.True(resultValidation.IsValid); }
public void PutReturnsBadRequest_PublicationNotValid() { var publication = PublicationBuilder.New().Build(); creator.CreateNewRegister(publication); var result = controller.Put(publication.Id, "", "Conteudo", publication.Topic.Id); Assert.IsType <BadRequestObjectResult>(result.Result); }
public void PutReturnsOk() { var publication = PublicationBuilder.New().Build(); new CreatePublication().CreateNewRegister(publication); var result = controller.Put(publication.Id, "Nome Put", publication.Content, publication.Topic.Id); Assert.IsType <OkObjectResult>(result.Result); }
public void TestValidationPublicationBadUser() { var badUser = UserBuilder.New().WithEmail("emailemail.com").Build(); var badPublication = PublicationBuilder.New().WithAutor(badUser).Build(); var resultValidation2 = new PublicationValidator().Validate(badPublication); Assert.False(resultValidation2.IsValid); }
public void GetByIdReturnsOk() { var publication = PublicationBuilder.New().Build(); creator.CreateNewRegister(publication); var result = controller.Get(publication.Id); Assert.IsType <OkObjectResult>(result.Result); }
public void TestCreateWithId() { Publication publication = PublicationBuilder.New().Build(); Assert.True(publication.Id != null && publication.Id != Guid.Empty); Assert.True(publication.Autor.Id != Guid.Empty && publication.Autor.Id != null); Assert.True(publication.Title == "TestPost"); Assert.True(publication.Content == "Test Post Builder"); Assert.True(publication.DateCreated.Date == DateTime.Today); Assert.True(publication.Comments != null && publication.Comments.Count == 0); Assert.True(publication.Topic.Id != Guid.Empty && publication.Topic.Id != null); }
public void TestEntityDelete() { var pub = PublicationBuilder.New().Build(); var mockTeste = new Mock <IDeleteDB <Publication> >(); var publicationRepository = new PublicationRepository(mockTeste.Object); publicationRepository.Delete(pub); mockTeste.Verify(x => x.DeleteRegister(It.IsAny <Publication>())); }
public void TestUpdate() { Publication publication = PublicationBuilder.New().Build(); new CreatePublication().CreateNewRegister(publication); var publicationAlter = PublicationBuilder.New().WithId(publication.Id).WithTitle("Teste API").Build(); new UpdatePublication().UpdateRegister(publicationAlter); Assert.IsTrue(publicationAlter.Title.ToString() != publication.Title.ToString()); Assert.IsTrue(publicationAlter.Id.ToString() == publication.Id.ToString()); }
public void PostReturnsOk() { var user = UserBuilder.New().Build(); new CreateUser().CreateNewRegister(user); var publication = PublicationBuilder.New().Build(); new CreatePublication().CreateNewRegister(publication); var result = controller.Post(user.Id, "Conteudo", publication.Id); Assert.IsType <CreatedAtActionResult>(result.Result); }
public void PostReturnsBadRequest_CommentInvalid() { var user = UserBuilder.New().Build(); new CreateUser().CreateNewRegister(user); var publication = PublicationBuilder.New().Build(); new CreatePublication().CreateNewRegister(publication); var result = controller.Post(user.Id, "", publication.Id); Assert.IsType <BadRequestObjectResult>(result.Result); }
public void TestGetAll() { Publication publicationFirst = PublicationBuilder.New().Build(); Publication publicationSecond = PublicationBuilder.New().Build(); Publication publicationThird = PublicationBuilder.New().Build(); // Produção através dos métodos new CreatePublication().CreateNewRegister(publicationFirst); new CreatePublication().CreateNewRegister(publicationSecond); new CreatePublication().CreateNewRegister(publicationThird); List <Publication> listPublications = new GetPublication().GetAllRegister(); Assert.IsTrue(3 == listPublications.Count); }
public static CommentBuilder New() { var user = UserBuilder.New().Build(); new CreateUser().CreateNewRegister(user); var publication = PublicationBuilder.New().Build(); new CreatePublication().CreateNewRegister(publication); return(new CommentBuilder() { Id = Guid.NewGuid(), Autor = user, Content = "TestContent", PublicationId = publication.Id }); }
public void AddPublicationBuilder(PublicationBuilder builder) { m_Builders.Add(builder); }
public void RemovePublicationBuilder(PublicationBuilder builder) { m_Builders.Remove(builder); }