public async Task AddNewMessageAsync_WithCorrectData_CheckForExist() { var context = SteuDbContextInMemoryFactory.InitializeContext(); MessagesService service = this.IntializeMessagesService(context); var repository = new EfDeletableEntityRepository <Message>(context); var model = new SendMessageInputModel() { Content = "content", CountryFrom = "Bulgaria", CountryTo = "Serbia", OrderId = "orderId", RecipientId = "recipientId", Referer = "/", TownFrom = "Sofia", TownTo = "Nis", TruckTypeIcon = "asd", }; await service.AddNewMessageAsync("senderId", model); var actualArray = await repository.All().ToListAsync(); Assert.Single(actualArray); }
public async Task AddNewMessageAsync_WithNullSenderId_ShouldReturnArgumentNullException() { var context = SteuDbContextInMemoryFactory.InitializeContext(); MessagesService service = this.IntializeMessagesService(context); var repository = new EfDeletableEntityRepository <Message>(context); var model = new SendMessageInputModel() { Content = "Content", CountryFrom = "Bulgaria", CountryTo = "Serbia", OrderId = "orderId", RecipientId = "recipientId", Referer = "/", TownFrom = "Sofia", TownTo = "Nis", TruckTypeIcon = "asda", }; await Assert.ThrowsAsync <ArgumentNullException>(() => service.AddNewMessageAsync(null, model)); }