Search Results

Search found 2 results on 1 pages for 'thermite'.

Page 1/1 | 1 

  • Using Moq to Validate Separate Invocations with Distinct Arguments

    - by Thermite
    I'm trying to validate the values of arguments passed to subsequent mocked method invocations (of the same method), but cannot figure out a valid approach. A generic example follows: public class Foo { [Dependency] public Bar SomeBar { get; set; } public void SomeMethod() { this.SomeBar.SomeOtherMethod("baz"); this.SomeBar.SomeOtherMethod("bag"); } } public class Bar { public void SomeOtherMethod(string input) { } } public class MoqTest { [TestMethod] public void RunTest() { Mock<Bar> mock = new Mock<Bar>(); Foo f = new Foo(); mock.Setup(m => m.SomeOtherMethod(It.Is<string>("baz"))); mock.Setup(m => m.SomeOtherMethod(It.Is<string>("bag"))); // this of course overrides the first call f.SomeMethod(); mock.VerifyAll(); } } Using a Function in the Setup might be an option, but then it seems I'd be reduced to some sort of global variable to know which argument/iteration I'm verifying. Maybe I'm overlooking the obvious within the Moq framework?

    Read the article

  • HD failure questions ...

    - by JP
    I recently had one of my home PC hard drives fail. It was in a striped raid, so I had to rebuild the raid (no data lost, only the OS partition was there). Is there any way to diagnose exactly what went wrong with the drive? That is what caused the failure? Also, in general, what is a good way to dispose of a failed hard drive securely and realistically (I don't have thermite or muriatic acid)?

    Read the article

1