Dot memory unit test check always fails when specifying a specific namespace

I was implementing my first dotmemory unit test and found that if I specify a namespace that is a prefix of another it does not distinguish between the two.  For example my targeted namespace is called "Foo" but my unit test namespace is called "FooUnitTest".  If I try the code below the check always fails.  If I change the target to "XFoo" it succeeds. Since I'm not specifying a wildcard in the Like should it not perform an exact match?

 

[DotMemoryUnit(CollectAllocations = true, FailIfRunWithoutSupport = false)]
[TestMethod]
public void ConnectionMemoryLeakUnitTest()
{
MemoryCheckPoint memoryCheckPoint;
try
{
memoryCheckPoint = dotMemory.Check();

}
catch (DotMemoryUnitException ex)
{
Console.WriteLine(ex.Message);
}

 

var q = QueryBuilder.GetObjects(where => where.Namespace.Like("Foo"));

dotMemory.Check(memory =>
{
int x = memory.GetDifference(memoryCheckPoint)
.GetSurvivedObjects()
.GetObjects(q)
.ObjectsCount;
Assert.IsTrue(x == 0);
});

}

 

1 comment
Comment actions Permalink

Hello Henry,

Namespace is matched as Foo* .We'll investigate this issue.

Please use this code to avoid test fail:

...

.GetSurvivedObjects()
.GetObjects(q)
.GetObjects(where => where.Namespace.NotLike("FooUnitTest"))

...

Sorry for inconvenience.

0

Please sign in to leave a comment.