Closed davezych closed 8 years ago
I would go for both and also provide an overload with IEmunerable contexts
.
Personally, I prefer serializing the context in form of an dynamic
object using a high-performance JSON library like Jil.
The advantage of using an dynamic object is that I can preserve the name of the parameters inside the object:
var userCanRead = Shience.New<bool>()
.Test(() => UserPermissions.CheckUser(currentUser), () => User.Can(currentUser, Permission.Read))
.WithContext(new {
@class: nameof(MyClass),
method: nameof(Display),
currentUser,
timestamp: DateTime.UtcNow
})
.Execute();
Logging should ideally also provide the name and position of the code under test using reflection out of the box (think CallerMemberNameAttribute
).
Right now the
contexts
param of the test method is aparams object[]
. Should it usedynamic
?