public void DidI() { var correctHash = GetSha1("converter", "id", "sourceid"); var newHash = new DocumentId("converter", "id", "sourceid", "learningid").GetId(); Assert.Equal(correctHash, newHash); }
public void LearnCommandForInput(DocumentId completionId, string input) { using (var indexWriter = GetIndexWriter()) using (var indexReader = indexWriter.GetReader()) { LearnCommandForInput(indexWriter, indexReader, completionId, input); } }
public CommandResult(IItem item, DocumentId completionId, Explanation explanation = null) { Item = item; CompletionId = completionId; Explanation = explanation; }
private void LearnCommandForInput(IndexWriter writer, IndexReader reader, DocumentId completionId, string input) { // fickle command, isn't learnable if (completionId == null) return; var document = CoreDocument.Rehydrate(PopDocument(writer, reader, completionId.GetId())); if (document == null) throw new InvalidOperationException(string.Format("Didn't find command {0}", completionId)); var learnings = _learningRepository.LearnFor(input, completionId.GetLearningId()); document.SetLearnings(learnings); writer.AddDocument(document); }