public T FindOne <T>(Specification <T> spec) where T : IEntry, new() { var searcher = new LinqDirectorySearcher <T>(RepoEntry); searcher.SearchScope = SearchScope.Subtree; searcher.Filter = spec; var result = searcher.FindOne(); /*var pnames = new string[results[0].Properties.PropertyNames.Count]; * results[0].Properties.PropertyNames.CopyTo(pnames, 0); * var str = pnames.Join(",");*/ return(result); }
public void FindOne_ReturnsMappedFromBase() { var data = new SearchResultProxy() { Path = "ou=some,com=path", Properties = new EntryAttributeDictionary() }; Mock.Get(Searcher.Base) .Setup(m => m.FindOne()) .Returns(data); var results = Searcher.FindOne(); Mock.Get(Creator).Verify(m => m.Create <TestLdapModel>(data.Properties, data.Path), Times.Once); }