Exemplo n.º 1
0
        public void ShouldAddComplaintToDatabase(string title, string description)
        {
            // Arrange
            using var context = new ComplaintsContext(DbFixtureProvider.CreateNewContextOptions());
            var complaintService = new ComplaintService(context);
            var complaintEntity  = new ComplaintEntity
            {
                Title       = title,
                Description = description
            };

            // Act
            var createdComplaint = complaintService.AddComplaint(complaintEntity);

            // Assert
            var complaintInDb = context.Complaints.Find(createdComplaint.Id);

            Assert.NotNull(complaintInDb);
            Assert.Equal(createdComplaint, complaintInDb);
        }