I'm stumped. I have a simple object called Listing with two string
properties: Title and Description. I also have a guid Id. This
object and it's properties map to a SQL Server 2008 database. I also
have a full-text index on the Description field. All of my CRUD
persistence tests pass with the exception of full-text query tests.
Here is my simple full-text query method:
public Listing[] GetByFTS(string searchString){
return GetSession().CreateSQLQuery("SELECT * FROM dbo.Listings
WHERE
FREETEXT ([Description], :searchString, LANGUAGE
1033);","listings",
typeof(Listing)).SetString("searchString",
searchString).List<Listing>().ToArray();
}
By the way, this method works fine when I connect it to a controller
and view. But if fails when I try to do an integration test. The
following integration test ought to pass but it fails saying "Expected
1 But was 0".
[Test]
public void Full_Text_Search_Test()
{
Listing listing = new Listing() { Title = "My new
listing", Description = "It is time for all good men to come to the
aid of their country." };
PersistEntity(listing);
IListingRepository repository = new ListingRepository(new
HybridSessionBuilder());
Listing[] listings = repository.GetByFTS("men");
Assert.That(listings.Length, Is.EqualTo(1));
}
The strange thing is, when I set a break point and run this test with
the debugger and step through it, the test passes! It is only when I
run the test normally that it fails to retrive the record I just
added.
Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---