Skip to content

Commit

Permalink
Release 3.6.0
Browse files Browse the repository at this point in the history
+ #241 (LightBDD.Framework)(New) Added WithInferredColumns(InferredColumnsOrder columnsOrder) method to IInputTableBuilder and IVerifiableDataTableBuilder with option to add inferred columns in name or declaration order
+ #264 (LightBDD.Framework)(Fix) Corrected Html Report to expand feature background with the content
+ #265 (LightBDD.Framework)(Fix) Fixed InputTable and VerifiableTable to include Item column if no other columns are present and fail if provided object count and instances do not match
+ #265 (LightBDD.Core)(New) Added IFormatSymbols.EmptyValue property
+ #265 (LightBDD.Core)(New) Added IValueFormattingService.Symbols property
+ #265 (LightBDD.Framework)(Change) Updated CollectionFormatter and DictionaryFormatter to format empty collections
+ #268 (LightBDD.Framework)(New) Added InputTree<T> to provide detailed insights into the object structure upon progress and results rendering.
+ #268 (LightBDD.Framework)(New) Added VerifiableTree<T> to provide detailed structural verification of actual versus expected object hierarchies
+ #268 (LightBDD.Framework)(New) Added Tree class with a set of methods to create InputTree<T> and VerifiableTree<T> parameters
+ #268 (LightBDD.Framework)(Change) Equal() expectation supports now comparison of numeric types that have equivalent values, i.e. 5.0 (double) to 5 (int)
+ #268 (LightBDD.Framework)(Change) CastFrom() expectation support now conversions of numeric types that have equivalent values, i.e. 5.0 (double) to 5 (int)
+ #268 (LightBDD.Framework)(Change) InputTable value cells are rendered on Html Report with background color being consistent with color of non-verifiable parameters (pink)
+ #273 (LightBDD.XUnit2)(Change) Updated integration to detect exceptions thrown in LightBddScopeAttribute.OnSetUp() and fail scenarios instead of breaking test pipeline
  • Loading branch information
Suremaker committed Jan 7, 2023
1 parent 43a135b commit c300013
Show file tree
Hide file tree
Showing 150 changed files with 6,517 additions and 522 deletions.
8 changes: 4 additions & 4 deletions AssemblyVersion.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Reflection;

[assembly: AssemblyCopyright("Copyright © Wojciech Kotlarski 2013-2021")]
[assembly: AssemblyVersion("3.5.0")]
[assembly: AssemblyFileVersion("3.5.0")]
[assembly: AssemblyInformationalVersion("3.5.0")]
[assembly: AssemblyCopyright("Copyright © Wojciech Kotlarski 2013-2023")]
[assembly: AssemblyVersion("3.6.0")]
[assembly: AssemblyFileVersion("3.6.0")]
[assembly: AssemblyInformationalVersion("3.6.0")]
16 changes: 16 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
LightBDD
===========================================

Version 3.6.0
----------------------------------------
+ #241 (LightBDD.Framework)(New) Added WithInferredColumns(InferredColumnsOrder columnsOrder) method to IInputTableBuilder and IVerifiableDataTableBuilder with option to add inferred columns in name or declaration order
+ #264 (LightBDD.Framework)(Fix) Corrected Html Report to expand feature background with the content
+ #265 (LightBDD.Framework)(Fix) Fixed InputTable and VerifiableTable to include Item column if no other columns are present and fail if provided object count and instances do not match
+ #265 (LightBDD.Core)(New) Added IFormatSymbols.EmptyValue property
+ #265 (LightBDD.Core)(New) Added IValueFormattingService.Symbols property
+ #265 (LightBDD.Framework)(Change) Updated CollectionFormatter and DictionaryFormatter to format empty collections
+ #268 (LightBDD.Framework)(New) Added InputTree<T> to provide detailed insights into the object structure upon progress and results rendering.
+ #268 (LightBDD.Framework)(New) Added VerifiableTree<T> to provide detailed structural verification of actual versus expected object hierarchies
+ #268 (LightBDD.Framework)(New) Added Tree class with a set of methods to create InputTree<T> and VerifiableTree<T> parameters
+ #268 (LightBDD.Framework)(Change) Equal() expectation supports now comparison of numeric types that have equivalent values, i.e. 5.0 (double) to 5 (int)
+ #268 (LightBDD.Framework)(Change) CastFrom() expectation support now conversions of numeric types that have equivalent values, i.e. 5.0 (double) to 5 (int)
+ #268 (LightBDD.Framework)(Change) InputTable value cells are rendered on Html Report with background color being consistent with color of non-verifiable parameters (pink)
+ #273 (LightBDD.XUnit2)(Change) Updated integration to detect exceptions thrown in LightBddScopeAttribute.OnSetUp() and fail scenarios instead of breaking test pipeline

Version 3.5.0
----------------------------------------
+ #260 (LightBDD.MsTest2)(Change) Updated MSTest.TestFramework to 2.2.10
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 2-Clause License

Copyright (c) 2022, Wojciech Kotlarski
Copyright (c) 2023, Wojciech Kotlarski
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion QuickStart.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
LightBDD Quick Start:
#####################################

Thanks for installing LightBDD version 3.5.0!
Thanks for installing LightBDD version 3.6.0!

If you are new LightBDD user, please feel free to explore the LightBDD Wiki page, especially Quick Start: https://github.com/LightBDD/LightBDD/wiki/Quick-Start
If you just updated LightBDD from previous version, please read Wiki page about migrating LightBDD: https://github.com/LightBDD/LightBDD/wiki/Migrating-LightBDD-Versions
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ LightBDD offers multiple scenario formats and flavors suitable for various use c

The implementation of step methods is located in other part of the class, in separate file and leverages standard features of the underlying test framwork (such as assert mechanisms) empowered by LightBDD features such as:
* [Dependency Injection](https://github.com/LightBDD/LightBDD/wiki/DI-Containers),
* [Inline and Tabular parameters](https://github.com/LightBDD/LightBDD/wiki/Advanced-Step-Parameters),
* [Inline, Tabular, Tree-hierarchy parameters](https://github.com/LightBDD/LightBDD/wiki/Advanced-Step-Parameters),
* [Expectation Expressions](https://github.com/LightBDD/LightBDD/wiki/Expectation-Expressions),
* [Step comments](https://github.com/LightBDD/LightBDD/wiki/Step-Comments),
* [Scenario and Step Decorators](https://github.com/LightBDD/LightBDD/wiki/Extending-Test-Behavior).
Expand Down
17 changes: 17 additions & 0 deletions examples/Example.Domain/Domain/AddressBook.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Collections.Generic;
using System.Linq;

namespace Example.Domain.Domain
{
public class AddressBook
{
private readonly Dictionary<string, ContactAddress> _contactsByEmail = new Dictionary<string, ContactAddress>();
public IReadOnlyDictionary<string, ContactAddress> ContactsByEmail => _contactsByEmail;

public void AddContactAddress(ContactAddress contact) { _contactsByEmail[contact.Contact.Email] = contact; }

public IEnumerable<Contact> GetContacts() => _contactsByEmail.Values.Select(x => x.Contact).OrderBy(x => x.Name);

public IEnumerable<PostalAddress> GetAddresses() => _contactsByEmail.Values.Select(x => x.Address).OrderBy(x => x.Country).ThenBy(x => x.PostCode);
}
}
16 changes: 16 additions & 0 deletions examples/Example.Domain/Domain/ContactAddress.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Example.Domain.Domain
{
public class ContactAddress
{
public string Alias { get; set; }
public Contact Contact { get; }
public PostalAddress Address { get; set; }

public ContactAddress(string alias,Contact contact, PostalAddress address)
{
Alias = alias;
Contact = contact;
Address = address;
}
}
}
18 changes: 18 additions & 0 deletions examples/Example.Domain/Domain/PostalAddress.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Example.Domain.Domain
{
public class PostalAddress
{
public string Address { get; }
public string City { get; }
public string PostCode { get; }
public string Country { get; }

public PostalAddress(string country, string city, string postCode, string address)
{
Address = address;
City = city;
PostCode = postCode;
Country = country;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Shouldly" Version="4.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Shouldly" Version="4.1.0" />
<PackageReference Include="Fixie" Version="2.2.2" />
<DotNetCliToolReference Include="Fixie.Console" Version="2.2.1" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System.Text.Json;
using Example.Domain.Domain;
using LightBDD.Fixie2;
using LightBDD.Framework;
using LightBDD.Framework.Parameters;

namespace Example.LightBDD.Fixie2.Features
{
public partial class Address_book_feature : FeatureFixture
{
private AddressBook _book;
private string _json;

private void Given_an_empty_address_book()
{
_book = new AddressBook();
}

private void When_I_associate_contact_with_address_as_alias(InputTree<Contact> contact, InputTree<PostalAddress> address, string alias)
{
_book.AddContactAddress(new ContactAddress(alias, contact.Input, address.Input));
}

private void Then_address_by_email_should_match(VerifiableTree match)
{
match.SetActual(_book.ContactsByEmail);
}

private void Given_an_address_book_with_contacts(InputTree<ContactAddress[]> contacts)
{
_book = new AddressBook();
foreach (var address in contacts.Input)
_book.AddContactAddress(address);
}

private void When_I_persist_book_as_json()
{
_json = JsonSerializer.Serialize(_book);
}

private void Then_address_book_should_match_persisted_json(VerifiableTree json)
{
StepExecution.Current.Comment($"Underlying type: {json.Expected?.GetType().Name}");
json.SetActual(_book);
}

private void Then_address_book_should_contain_contacts(VerifiableTree<Contact[]> contacts)
{
contacts.SetActual(_book.GetContacts());
}

private void Then_address_book_should_contain_postal_addresses(VerifiableTree addresses)
{
addresses.SetActual(_book.GetAddresses());
}
}
}
113 changes: 113 additions & 0 deletions examples/Example.LightBDD.Fixie2/Features/Address_book_feature.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
using System.Collections.Generic;
using System.Dynamic;
using System.Text.Json;
using Example.Domain.Domain;
using LightBDD.Fixie2;
using LightBDD.Framework;
using LightBDD.Framework.Parameters;
using LightBDD.Framework.Scenarios;
using Newtonsoft.Json;

namespace Example.LightBDD.Fixie2.Features
{
/// <summary>
/// This feature class presents the usage of <see cref="InputTree{TData}"/> and <see cref="VerifiableTree{TData}"/> parameter types to structurally verify and visualize hierarchical object structure.
/// </summary>
[FeatureDescription(
@"In order to maintain my product dispatch
As an application user
I want to add and browse my client postal addresses by client emails")]
public partial class Address_book_feature
{
[Scenario]
public void Adding_contacts()
{
Runner.RunScenario(
_ => Given_an_empty_address_book(),
_ => When_I_associate_contact_with_address_as_alias(
new Contact("Joe Jonnes", "666777888", "joe67@email.com"),
new PostalAddress("UK", "London", "AB1 2CD", "47 Main Street"),
"Joey"),
_ => When_I_associate_contact_with_address_as_alias(
new Contact("Jan Nowak", "123654789", "nowak33@email.com"),
new PostalAddress("Poland", "Kraków", "31-042", "Rynek Główny 1"),
"Janek"),
_ => Then_address_book_should_contain_contacts(Tree.ExpectEquivalent(new[]
{
new Contact("Jan Nowak", "123654789", "nowak33@email.com"),
new Contact("Joel Jonnes", "666777888", "joe67@email.com")
})));
}

[Scenario]
public void Matching_addresses_by_email()
{
Runner.RunScenario(
_ => Given_an_empty_address_book(),
_ => When_I_associate_contact_with_address_as_alias(
new Contact("Joe Jonnes", "666777888", "joe67@email.com"),
new PostalAddress("UK", "London", "AB1 2CD", "47 Main Street"),
"Joey"),
_ => When_I_associate_contact_with_address_as_alias(
new Contact("Jan Nowak", "123654789", "nowak33@email.com"),
new PostalAddress("Poland", "Kraków", "31-042", "Rynek Główny 1"),
"Janek"),
_ => Then_address_by_email_should_match(Tree.ExpectContaining(new Dictionary<string, object>
{
{
"nowak33@email.com",
new
{
Address = new { City = "Kraków", PostCode = "31-042", Address = "Rynek Główny 1" }
}
},
{
"joe67@email.com",
new
{
Address = new { City = "London", PostCode = "AB1 2CD", Address = "47 Main Street" }
}
}
})));
}

[Scenario]
public void Persisting_address_book()
{
Runner.RunScenario(
_ => Given_an_address_book_with_contacts(new[]
{
new ContactAddress("Joey",
new Contact("Joe Jonnes", "666777888", "joe67@email.com"),
new PostalAddress("UK", "London", "AB1 2CD", "47 Main Street")),
new ContactAddress("Janek",
new Contact("Jan Nowak", "123654789", "nowak33@email.com"),
new PostalAddress("Poland", "Kraków", "31-042", "Rynek Główny 1"))
}),
_ => When_I_persist_book_as_json(),
_ => Then_address_book_should_match_persisted_json(Tree.ExpectEquivalent(JsonDocument.Parse(_json, default).RootElement)),
_ => Then_address_book_should_match_persisted_json(Tree.ExpectEquivalent(JsonConvert.DeserializeObject<ExpandoObject>(_json))));
}

[Scenario]
public void Retrieving_postal_addresses()
{
Runner.RunScenario(
_ => Given_an_empty_address_book(),
_ => When_I_associate_contact_with_address_as_alias(
new Contact("Joe Jonnes", "666777888", "joe67@email.com"),
new PostalAddress("UK", "London", "AB1 2CD", "47 Main Street"),
"Joey"),
_ => When_I_associate_contact_with_address_as_alias(
new Contact("Jan Nowak", "123654789", "nowak33@email.com"),
new PostalAddress("Poland", "Kraków", "31-042", "Rynek Główny 1"),
"Janek"),
_ => Then_address_book_should_contain_postal_addresses(Tree.ExpectEquivalent(new[]
{
new { Country = "Poland", City = "Kraków", PostCode = "31-042", Address = "Rynek Główny 1" },
new { Country = "UK", City = "London", PostCode = "AB1 2CD", Address = "47 Main Street" }
}))
);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Threading;
using LightBDD.Fixie2;
using LightBDD.Framework.Parameters;

namespace Example.LightBDD.Fixie2.Features
{
public partial class Record_persistence_feature : FeatureFixture
{
class DataRecord
{
public Guid Id { get; set; }
public DateTimeOffset ModifiedDate { get; set; }
public string Name { get; set; }
}

private readonly List<DataRecord> _records = new List<DataRecord>();

private void Given_no_saved_records()
{
_records.Clear();
}

private void When_I_save_records(InputTree<string[]> records)
{
foreach (var name in records.Input)
{
_records.Add(new DataRecord { Id = Guid.NewGuid(), ModifiedDate = DateTimeOffset.UtcNow, Name = name });
Thread.Sleep(TimeSpan.FromSeconds(1));
}
}

private void Then_the_saved_records_should_match_expectation(VerifiableTree expectation)
{
expectation.SetActual(_records);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using LightBDD.Fixie2;
using LightBDD.Framework.Expectations;
using LightBDD.Framework.Parameters;
using LightBDD.Framework.Scenarios;

namespace Example.LightBDD.Fixie2.Features
{
/// <summary>
/// This feature class presents the usage of <see cref="InputTree{TData}"/> and <see cref="VerifiableTree{TData}"/> parameter types to structurally verify and visualize hierarchical object structure.
/// </summary>
public partial class Record_persistence_feature
{
[Scenario]
public void Saving_data()
{
var testRunDate = DateTimeOffset.UtcNow;

Runner.RunScenario(
_ => Given_no_saved_records(),
_ => When_I_save_records(new[] { "Record 1", "Record 2" }),
_ => Then_the_saved_records_should_match_expectation(Tree.ExpectEquivalent(new[]
{
new
{
Id = Expect.To.Not.Equal(Guid.Empty),
ModifiedDate = Expect.To.BeGreaterOrEqual(testRunDate),
Name = Expect.To.BeLike("Recr*")
},
new
{
Id = Expect.To.Equal(Guid.Empty),
ModifiedDate = Expect.To.BeLessThan(testRunDate),
Name = Expect.To.Equal("Record 2")
},
}))
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit c300013

Please sign in to comment.