Block(ChatRole.USER, "Prompt of an assistant", 3, hidden: true),
Block(ChatRole.AI, "Answer to the assistant", 4),
],
};
varrolledBack=thread.RollBackTo(answer.Content!);
Assert.Multiple(()=>
{
Assert.That(rolledBack,Is.True,"Two blocks came after the answer, so the rollback removed something.");
Assert.That(Texts(thread),Is.EqualTo(new[]{"First question","First answer"}),"The hidden prompt goes with the answer to it, although the user never saw it.");
Assert.That(Texts(thread),Is.EqualTo(new[]{"Example question","Example answer","First question","First answer"}),"Hidden blocks before the answer belong to what the user rolls back to, so the chat template keeps its example conversation.");
Assert.That(Texts(thread),Is.EqualTo(new[]{"First question","First answer"}),"The chat shows its blocks by time, so a rollback has to count by time as well, wherever a block sits in the list.");
Assert.That(thread.AugmentedData,Is.Empty,"Nobody knows whether the retrieved data belongs to a kept or to a removed message, so it must not reach the next system prompt.");
Assert.That(thread.AISelectedDataSources,Is.Empty,"The data sources an agent picked belong to the same retrieval as the data.");
Assert.That(thread.DataSourceOptions,Is.SameAs(options),"The data source options are the user's choice, not the result of a message.");
Assert.That(thread.DataSecurity,Is.EqualTo(DataSourceSecurity.SELF_HOSTED),"The confidential data was seen by this chat, so no cloud provider may continue it.");
Assert.That(thread.RequiredProviderConfidence,Is.EqualTo(ConfidenceLevel.HIGH),"The confidence the data demanded stays, although the message which brought it in is gone.");
Assert.That(thread.RequiredOutboundDataRestriction,Is.EqualTo(restriction),"The mail content was read by this chat, so it may still carry it out no further than before.");
Assert.That(rolledBack,Is.False,"Nothing came after the content, so there was nothing to roll back.");
Assert.That(Texts(thread),Is.EqualTo(expectedTexts),"A rollback without anything to remove leaves the blocks alone.");
Assert.That(thread.AugmentedData,Is.EqualTo("A chunk from the handbook"),"A rollback without anything to remove keeps the last retrieval, because it still belongs to the last message.");