{"_id":"55584469e54fe019002a4f4b","initVersion":{"_id":"54c4b17873b3db0d001a756c","version":"1.0"},"tags":[],"__v":0,"project":"54c4b17873b3db0d001a7569","user":{"_id":"54c837f0ab706219009e0676","username":"","name":"Rob Moore"},"createdAt":"2015-05-17T07:34:01.652Z","changelog":[],"body":"We're pleased to announce the release of TestStack.Dossier version 3.0. We've been working on some exciting changes to make the library even more useful and even easier to use. As usual you can [grab the changes on NuGet](https://www.nuget.org/packages/TestStack.Dossier).\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Builder<T> class - generic test data builder\"\n}\n[/block]\nIf you are building domain entities, or other important classes, having a custom builder class with intention-revealing methods like  `WithFirstName` provides terseness (by avoiding lambda expressions) as well as allowing the builder class to start forming documentation about the usage of that object. Sometimes though, you just want to build a class without that ceremony. Typically, we find that this applies for view models and DTOs.\n\nTo that end we have created a generic implementation of the Test Data Builder class with syntax that is very similar in both form and function to what NBuilder provides, e.g.:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var vm = Builder<StudentViewModel>.CreateNew()\\n  .Set(x => x.FirstName, \\\"Pi\\\")\\n  .Set(x => x.LastName, \\\"Lanningham\\\")\\n  .Set(x => x.EnrollmentDate, new DateTime(2000, 1, 1))\\n  .Build();\\n\\nvar i = 0;\\nvar studentViewModels = Builder<StudentViewModel>.CreateListOfSize(5)\\n  .TheFirst(1).Set(x => x.FirstName, \\\"First\\\")\\n  .TheNext(1).Set(x => x.LastName, \\\"Next Last\\\")\\n  .TheLast(1).Set(x => x.LastName, \\\"Last Last\\\")\\n  .ThePrevious(2).With(b => b.Set(x => x.LastName, \\\"last\\\" + (++i).ToString()))\\n  .All().Set(x => x.EnrollmentDate, _enrollmentDate)\\n  .BuildList();\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\nBy default, the longest constructor of the class you specify will be called and then all properties (with public and private setters) will be set with values you specified (or anonymous values if none were specified). The behaviour of this can be modified though.\n\nFeel free to check out the [implementation](https://github.com/TestStack/TestStack.Dossier/blob/master/TestStack.Dossier/Builder.cs) (it's incredibly simple) and the [documentation](http://dossier.teststack.net/v1.0/docs/create-object-without-requiring-custom-builder-cla) for this feature.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Automatic object construction support\"\n}\n[/block]\nPreviously you would be forced to override the `BuildObject` method when extending `TestDataBuilder`. You would then need to call the constructor of your object and pass in the values using `Get(...)` or otherwise. While this is useful for complex objects, for simpler objects it feels like boilerplate since you are typically doing a 1:1 relationship between constructor parameters and properties (via `Get`).\n\nTo that end we have created some factories that use the builder instance to intelligently instantiate your object by convention. You can invoke this via the `BuildUsing` method, e.g.:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class CustomerBuilder : TestDataBuilder<Customer, CustomerBuilder>\\n{\\n  ...\\n\\n  protected override Customer BuildObject()\\n  {\\n    return BuildUsing<CallConstructorFactory>();\\n  }\\n}\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\nIf you don't override the `BuildObject` method then by default it will use the `PublicPropertySettersFactory`, which calls the longest constructor with builder values (or anonymous values if none set) based on case-insensitive match of constructor parameter names against property names and then calls the setter on all properties with public setters with builder values (or anonymous values if none set).\n\nThere are other factories available and these are explained in the [documentation](http://dossier.teststack.net/v1.0/docs/build-objects-without-calling-constructor) .\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Breaking changes\"\n}\n[/block]\nThere was a breaking change in this version to the signature of `IAnonymousValueSupplier` in order to allow for the implementation of the automatic object construction support. We anticipate this won't affect most users, but in light of the fact there was a breaking change we have bumped the version number to 3.0. You can consult the [breaking changes documentation](https://github.com/TestStack/TestStack.Dossier/blob/master/BREAKING_CHANGES.md#version-30) for more information.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Documentation update\"\n}\n[/block]\nWe have started to better document Dossier with this release and while there is still a ways to go to provide the comprehensiveness of documentation we would like, the majority of the features in Dossier are now explored in the [documentation](http://dossier.teststack.net/v1.0/docs/introduction)","slug":"announcing-teststackdossier-v30","title":"Announcing TestStack.Dossier v3.0"}

Announcing TestStack.Dossier v3.0


We're pleased to announce the release of TestStack.Dossier version 3.0. We've been working on some exciting changes to make the library even more useful and even easier to use. As usual you can [grab the changes on NuGet](https://www.nuget.org/packages/TestStack.Dossier). [block:api-header] { "type": "basic", "title": "Builder<T> class - generic test data builder" } [/block] If you are building domain entities, or other important classes, having a custom builder class with intention-revealing methods like `WithFirstName` provides terseness (by avoiding lambda expressions) as well as allowing the builder class to start forming documentation about the usage of that object. Sometimes though, you just want to build a class without that ceremony. Typically, we find that this applies for view models and DTOs. To that end we have created a generic implementation of the Test Data Builder class with syntax that is very similar in both form and function to what NBuilder provides, e.g.: [block:code] { "codes": [ { "code": "var vm = Builder<StudentViewModel>.CreateNew()\n .Set(x => x.FirstName, \"Pi\")\n .Set(x => x.LastName, \"Lanningham\")\n .Set(x => x.EnrollmentDate, new DateTime(2000, 1, 1))\n .Build();\n\nvar i = 0;\nvar studentViewModels = Builder<StudentViewModel>.CreateListOfSize(5)\n .TheFirst(1).Set(x => x.FirstName, \"First\")\n .TheNext(1).Set(x => x.LastName, \"Next Last\")\n .TheLast(1).Set(x => x.LastName, \"Last Last\")\n .ThePrevious(2).With(b => b.Set(x => x.LastName, \"last\" + (++i).ToString()))\n .All().Set(x => x.EnrollmentDate, _enrollmentDate)\n .BuildList();", "language": "csharp" } ] } [/block] By default, the longest constructor of the class you specify will be called and then all properties (with public and private setters) will be set with values you specified (or anonymous values if none were specified). The behaviour of this can be modified though. Feel free to check out the [implementation](https://github.com/TestStack/TestStack.Dossier/blob/master/TestStack.Dossier/Builder.cs) (it's incredibly simple) and the [documentation](http://dossier.teststack.net/v1.0/docs/create-object-without-requiring-custom-builder-cla) for this feature. [block:api-header] { "type": "basic", "title": "Automatic object construction support" } [/block] Previously you would be forced to override the `BuildObject` method when extending `TestDataBuilder`. You would then need to call the constructor of your object and pass in the values using `Get(...)` or otherwise. While this is useful for complex objects, for simpler objects it feels like boilerplate since you are typically doing a 1:1 relationship between constructor parameters and properties (via `Get`). To that end we have created some factories that use the builder instance to intelligently instantiate your object by convention. You can invoke this via the `BuildUsing` method, e.g.: [block:code] { "codes": [ { "code": "public class CustomerBuilder : TestDataBuilder<Customer, CustomerBuilder>\n{\n ...\n\n protected override Customer BuildObject()\n {\n return BuildUsing<CallConstructorFactory>();\n }\n}", "language": "csharp" } ] } [/block] If you don't override the `BuildObject` method then by default it will use the `PublicPropertySettersFactory`, which calls the longest constructor with builder values (or anonymous values if none set) based on case-insensitive match of constructor parameter names against property names and then calls the setter on all properties with public setters with builder values (or anonymous values if none set). There are other factories available and these are explained in the [documentation](http://dossier.teststack.net/v1.0/docs/build-objects-without-calling-constructor) . [block:api-header] { "type": "basic", "title": "Breaking changes" } [/block] There was a breaking change in this version to the signature of `IAnonymousValueSupplier` in order to allow for the implementation of the automatic object construction support. We anticipate this won't affect most users, but in light of the fact there was a breaking change we have bumped the version number to 3.0. You can consult the [breaking changes documentation](https://github.com/TestStack/TestStack.Dossier/blob/master/BREAKING_CHANGES.md#version-30) for more information. [block:api-header] { "type": "basic", "title": "Documentation update" } [/block] We have started to better document Dossier with this release and while there is still a ways to go to provide the comprehensiveness of documentation we would like, the majority of the features in Dossier are now explored in the [documentation](http://dossier.teststack.net/v1.0/docs/introduction)