semantic-comparison

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

半世苍凉 提交于 2020-03-01 01:56:10
问题 I'm trying to understand how to use the CreateProxy() feature of Likeness<T>() 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 a Fixture to Create<T> a Band instance with values for the two string properties. [Fact] public void Equality_Behaves_As_Expected() { // arrange var fixture = new Fixture(); fixture.Customize(new AutoMoqCustomization()); var original = fixture.Create<Band>

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

梦想与她 提交于 2020-03-01 01:55:57
问题 I'm trying to understand how to use the CreateProxy() feature of Likeness<T>() 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 a Fixture to Create<T> a Band instance with values for the two string properties. [Fact] public void Equality_Behaves_As_Expected() { // arrange var fixture = new Fixture(); fixture.Customize(new AutoMoqCustomization()); var original = fixture.Create<Band>

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

只愿长相守 提交于 2019-12-18 09:24:08
问题 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 side I don't care about ordering (and don't want my Assertion to break under re-ordering) How do I verify that each and every input item maps to one and only one output item in a DAMP yet DRY manner using as much OOTB componentry as possible ?

Likeness - polishing and packaging

Deadly 提交于 2019-12-02 12:01:22
问题 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, which looks like this: [Theory, AutoData] static void ShouldYieldIdentifierUpdatedEvent( Vendor sut, string name, string version, Guid id ) { var result = sut.SyncProduct( name, version, id ); var expected = new { ProductId = id, Name = name,

Likeness - polishing and packaging

梦想与她 提交于 2019-12-02 04:15:00
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, which looks like this: [Theory, AutoData] static void ShouldYieldIdentifierUpdatedEvent( Vendor sut, string name, string version, Guid id ) { var result = sut.SyncProduct( name, version, id ); var expected = new { ProductId = id, Name = name, Version = version }; expected.AsSource().OfLikeness<NewMappingsEvent>() .Without( y => y

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

拥有回忆 提交于 2019-11-28 07:41:15
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<CodeTableItem> expectedValutaList = new List<CodeTableItem>(); expectedValutaList.Add(new CodeTableItem("DKK", "DKK")); expectedValutaList.Add(new CodeTableItem("EUR", "EUR")); RepoDac target = new RepoDac(); var actual = target.GetValutaKd(); CollectionAssert.AreEqual(expectedValutaList.ToList(),actual.ToList()); The test works fine, but has the unfortunate dependency to the Equality -function, meaning if I extend the CodeTableItem -class

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

旧巷老猫 提交于 2019-11-27 01:56:11
问题 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<CodeTableItem> expectedValutaList = new List<CodeTableItem>(); expectedValutaList.Add(new CodeTableItem("DKK", "DKK")); expectedValutaList.Add(new CodeTableItem("EUR", "EUR")); RepoDac target = new RepoDac(); var actual = target.GetValutaKd(); CollectionAssert.AreEqual(expectedValutaList.ToList(),actual.ToList()); The test works fine, but