public async Task CreateTicket() { // Inject CreateIdentity(Users[0].Auth); // Arrange var ticket = new SupportTicket() { Title = "Gosho", Description = "pesho", UserId = Users[0].Id }; SupportTicket exp; // Act var result = await controller.CreateTicket(ticket); using (var a = factory.CreateDbContext()) { exp = await a.SupportTicket.Where(x => x.Title == "Gosho" && x.Description == "pesho").FirstOrDefaultAsync(); } var expected = mapper.Map <SupportTicketViewModel>(exp); // Assert Assert.Equal(Serialize(expected), Serialize(((OkObjectResult)result).Value)); }