public async Task GetPublishedMessageAsync_Test() { var sql = "INSERT INTO `cap.published`(`Name`,`Content`,`Retries`,`Added`,`ExpiresAt`,`StatusName`) VALUES(@Name,@Content,@Retries,@Added,@ExpiresAt,@StatusName);SELECT @@IDENTITY;"; var publishMessage = new CapPublishedMessage { Name = "MySqlStorageConnectionTest", Content = "", StatusName = StatusName.Scheduled }; var insertedId = default(int); using (var connection = ConnectionUtil.CreateConnection()) { insertedId = connection.QueryFirst <int>(sql, publishMessage); } var message = await _storage.GetPublishedMessageAsync(insertedId); Assert.NotNull(message); Assert.Equal("MySqlStorageConnectionTest", message.Name); Assert.Equal(StatusName.Scheduled, message.StatusName); }
public async Task GetPublishedMessageAsync_Test() { var sql = "INSERT INTO `cap.published`(`Id`,`Version`,`Name`,`Content`,`Retries`,`Added`,`ExpiresAt`,`StatusName`) VALUES(@Id,'v1',@Name,@Content,@Retries,@Added,@ExpiresAt,@StatusName);"; var insertedId = SnowflakeId.Default().NextId(); var publishMessage = new CapPublishedMessage { Id = insertedId, Name = "MySqlStorageConnectionTest", Content = "", StatusName = StatusName.Scheduled }; using (var connection = ConnectionUtil.CreateConnection()) { await connection.ExecuteAsync(sql, publishMessage); } var message = await _storage.GetPublishedMessageAsync(insertedId); Assert.NotNull(message); Assert.Equal("MySqlStorageConnectionTest", message.Name); Assert.Equal(StatusName.Scheduled, message.StatusName); }