// Tests for knowledge pipeline using System; using AIBrain.Services; using Xunit; namespace AIBrain.Tests { public class TestKnowledgePipeline { [Fact] public void TestAddFact() { var pipeline = new KnowledgePipeline(); pipeline.AddFact("Test fact"); Assert.Equal(1, pipeline.Count); } [Fact] public void TestGetFacts() { var pipeline = new KnowledgePipeline(); pipeline.AddFact("Fact 1"); pipeline.AddFact("Fact 2"); var facts = pipeline.GetFacts(); Assert.Equal(2, facts.Count); Assert.Contains("Fact 1", facts); Assert.Contains("Fact 2", facts); } [Fact] public void TestSearchFacts() { var pipeline = new KnowledgePipeline(); pipeline.AddFact("Machine learning is powerful"); pipeline.AddFact("Deep learning uses neural networks"); pipeline.AddFact("Python is great for ML"); var results = pipeline.SearchFacts("learning"); Assert.Equal(2, results.Count); } [Fact] public void TestClearFacts() { var pipeline = new KnowledgePipeline(); pipeline.AddFact("Test"); pipeline.ClearFacts(); Assert.Equal(0, pipeline.Count); } [Fact] public void TestGetStatistics() { var pipeline = new KnowledgePipeline(); pipeline.AddFact("Fact 1"); pipeline.AddFact("Fact 2"); var stats = pipeline.GetStatistics(); Assert.Equal(2, stats["total_facts"]); Assert.Equal(2, stats["unique_facts"]); } } }