Questions tagged [semantic-comparison]

SemanticComparison is a library for comparing objects for semantic equality.

SemanticComparison is a library for comparing objects for semantic equality. Object can be compared to other object, with equality rules based on the contents of the objects, rather than the place in memory they occupy, or their implementations of the Equals method.

This is useful in unit testing, and has historically been a companion project to AutoFixture.

13 questions
14
votes
5 answers

Applying [AutoFixture] SemanticComparison OfLikeness to sequences / collections / arrays / IEnumerable

We have written a test which looks like the following. This test requires that we have created en Equal-overload for the CodeTableItem-class: ICollection expectedValutaList = new List(); expectedValutaList.Add(new…
7
votes
1 answer

Why doesn't simple test pass using AutoFixture Freeze, SemanticComparison Likeness and CreateProxy?

I'm trying to understand how to use the CreateProxy() feature of Likeness() using two instances of a simple class. public class Band { public string Strings { get; set; } public string Brass { get; set; } } With the following test, I use…
Jeff
  • 2,191
  • 4
  • 30
  • 49
5
votes
1 answer

Is it possible in AutoFixture SemanticComparison to set custom comparer for specified type

Is it possible in AutoFixture SemanticComparison to set custom comparer for specified property of a object or for specified type. For example you need to compare objects that have property of type DateTime. You want to compare them using Likenes…
Krzysztof Branicki
  • 7,417
  • 3
  • 38
  • 41
3
votes
2 answers

Comparing nested object properties using SemanticComparison

I'm creating the unit test that will need to compare two objects of the same type memberwise. I've decided to use SemanticComparison library to handle this task without writing custom comparer code. It works really well when comparing flat objects,…
JMansar
  • 208
  • 2
  • 9
3
votes
1 answer

Why doesn't Autofixture Likeness behave like I'd expect for one of these two tests?

Given these classes: public class DrumAndBassBand { public Drums Drum { get; set; } public Bass Bass { get; set; } } public class Instrument { public string Name { get; set; } public int SerialNumber { get; set; } } public class…
Jeff
  • 2,191
  • 4
  • 30
  • 49
3
votes
1 answer

Trouble using Autofixture's CreateProxy to use Likeness, SemanticComparison features

In an earlier question I asked about Autofixture's CreateProxy method, a potential bug was identified. I don't think this failing test is as a result of that, but rather my continued confusion about how the Likeness.Without(...).CreateProxy()…
Jeff
  • 2,191
  • 4
  • 30
  • 49
2
votes
1 answer

How to compare two anonymous types or two collection of different types using SemanticComparison

1. Is there a simple way to compare two anonymous types using SemanticComparison from AutoFixture ? My current issue is that I can't construct Likeness for second anonymous object. Simplified example : var srcAnon = new { time = expectedTime, data =…
Alexey Shcherbak
  • 3,394
  • 2
  • 27
  • 44
2
votes
1 answer

Why can't I create a likeness proxy when abstract class not exposing every constructor argument?

I'm using Ploeh's SemanticComparison library with great success - except when I have an abstract class involved that doesn't expose all of its constructor arguments. Here is the exception I get - Ploeh.SemanticComparison.ProxyCreationException : The…
self.
  • 1,612
  • 4
  • 18
  • 35
1
vote
1 answer

NUnit: Track down difference between expected and actual in composite result using SemanticComparison .NET library

I'm using SemanticComparison in my unit tests (NUnit) and often getting errors like this: Expected Likeness of T But was T I tracked errors like these down before, as this is due to some subproperty not being equal to the expected value that I…
Bart
  • 5,065
  • 1
  • 35
  • 43
1
vote
2 answers

Verifying complete Mapping of an [unordered] Collection/Set of Items in a Unit Test

I'm using xUnit.net, AutoFixture and SemanticComparison and want to verify the results of a mapping. On the individual item level, I'm well covered. Given The items share an identifying key I want to do a comparison on the value elements on both…
Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
1
vote
1 answer

Likeness - polishing and packaging

I'm using Ploeh.SemanticComparison's Likeness as a way to effectively express intended outputs of a mapping process (as described in Mark Seemann's excellent Advanced Unit Testing course on PluralSight). I'm testing some data has mapped correctly,…
Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
0
votes
1 answer

Should I be using whole available data for training my deep learning model ? What are the pros and cons of using only a subset?

I have a very complex LSTM based neural network model which I'm training on Quora Duplicate Question pairs. There are approximately 400 000 sentence pairs in the original dataset. It would take a lot of processing power and computation time to train…
Jeena KK
  • 143
  • 1
  • 1
  • 11
0
votes
1 answer

Use dkpro semantic similarity with uby

I want to compute similarity between strings with dkpro similarity (https://dkpro.github.io/dkpro-similarity/), it works, like so: import org.dkpro.similarity.algorithms.api.SimilarityException; import…