Discussions
Using ConfigureContainer to pass an IEnumerable<T> isn't playing nice
I'm trying to write a spec for a class that takes as its ctor parameter an IEnumerable object. I'm overriding ConfigureContainer and specifying a List of real objects however the sut isn't seeing those values. Any ideas?
SpecsFor<object?>
I have a test I need to write that is for a static method on a static class. Since I don't need a SUT to be created, I don't really have anything to put between the angle brackets on the base class. I could just not inherit from SpecsFor at all, but then I have one mutant test that doesn't match the others in terms of style. I'd like to keep the pattern of overriding Given and When for consistency with my other tests. Is there an established or generally accepted pattern for this? I can inherit from SpecsFor and it doesn't seem to complain, but can I count on this in the future?
Constructor will be called before calling Given()-method
Hello,
Verification of list parameters
I'm trying to verify a call was made to a repository AddRange method. I can verify the method was called at all like this:
Installation - SpecsFor
Hi Matt:
Problem with 2015/4.5
I see that there's a fork project that says it's for VS 2015 and .Net 4.6, but I'm on a project using 4.5, and I can't seem to get SpecsFor.MVC working. The regular version fails to install right, complaining that the browser drivers already exist. I can push past that by trying the install multiple times, but I still don't end up with a SpecsFor.Mvc reference in the project, even though the NuGet package seems to think it should be there. I tried the fork project, but didn't have any better luck there since it wants to reference a higher version of the System.Web.Mvc assembly.
Primitive dependencies
Moq has a way of specifying values for primitive dependencies. Is there any way to explain this to SpecsFor without completely taking over the SUT construction via InitializeClassUnderTest?
Any advice for use with Knockout?
I'm on a project now that uses Knockout on the front-end, but I'm hopelessly addicted to SpecsFor.Mvc. I imagine that if the on-page controls follow the same naming convention as MVC would have, then SpecsFor would still be able to find them and use them. As I understand it from the MvcTemplates package, the magic is in wrapping a span around the controls and naming it after the property on the viewmodel. Is this correct? Are there any examples of workable patterns for integrating with Knockout? How about other front-end technologies like Angular?
BeforeEachSpec?
There is an AfterEachSpec, but no matching BeforeEachSpec. Given and When seem to run once per fixture if I'm not mistaken, or at least they appear to be working that way. I have a specific mock that I want to set up differently for one test. Yes, I know that's technically a new context, and I should build a new fixture, but that's would be so heavy in this case that I opted for a simpler text fixture with the individual tests taking some responsibility for tweaking the mocks. Don't you judge me... stop looking at me like that! I am NOT doing it wrong! Okay, fine, I'm doing it wrong. Anyway, I'm seeing the mock behavior bleed over from one test to another depending on their execution order. What I'd like is to set up the 99% behavior in a BeforeEachSpec, and tweak it in just the one test that deviates.
ShouldLookLike for a List
How can I assert a list, something like below:
myResult.ShouldLookLike(() =>
new List(){
new MyObject(){
//resultId is Guid, so this should be ignore
ObjectName = "result name 1",
ObjectValue = "object value 1"
},
new MyObject(){
//resultId is Guid, so this should be ignore
ObjectName = "result name 2",
ObjectValue = "object value 2"
}
}
