Search Results

Search found 8 results on 1 pages for 'richk'.

Page 1/1 | 1 

  • Why not write all tests at once when doing TDD? [closed]

    - by RichK
    Possible Duplicate: Why not write all tests at once when doing TDD? The Red - Green - Refactor cycle for TDD is well established and accepted. We write one failing unit test and make it pass as simply as possible. What are the benefits to this approach over writing many failing unit tests for a class and make them all pass in one go. The test suite still protects you against writing incorrect code or making mistakes in the refactoring stage, and code coverage should be just as high, so what's the harm? Sometimes it's easier to write all the tests first as a form of 'brain dump' to quickly write down all the expected behavior in one go.

    Read the article

  • Why not write all tests at once when doing TDD?

    - by RichK
    The Red - Green - Refactor cycle for TDD is well established and accepted. We write one failing unit test and make it pass as simply as possible. What are the benefits to this approach over writing many failing unit tests for a class and make them all pass in one go. The test suite still protects you against writing incorrect code or making mistakes in the refactoring stage, so what's the harm? Sometimes it's easier to write all the tests first as a form of 'brain dump' to quickly write down all the expected behavior in one go.

    Read the article

  • double.NaN Equality in MS Test

    - by RichK
    Why am I getting this result? [TestMethod] public void nan_test() { Assert.AreEqual(1, double.NaN, 1E-1); <-- Passes Assert.AreEqual(1, double.NaN); <-- Fails } What difference does the delta have in asserting NaN equals a number? Surely it should always return false. I am aware of IsNaN, but that's not useful here (see below). Background: I have a function returning NaN (erroneously) , it was meant to be a real number but the test still passed. I'm using the delta because it's double precision equality, the original test used 1E-9.

    Read the article

  • var keyword without 'using someNamespace'

    - by RichK
    How does Visual Studio/intellisense know what to do with a variable declared as var even if you don't include the necessary using declaration at the top? For example, I have class MyDomainObject defined in a different namespace If I don't declare using TheOtherNameSpace; in the file the following code won't compile: private void Foo() { MyDomainObject myObj = new MyDomainObject(); // Doesn't know what this class is } But if I use var var myObj = new MyDomainObject(); This will compile, and intellisense knows exactly what I can with it. So how the heck does it know what the type is without the using? (And as an aside, if it knows without the using, why do we need usings at all?!)

    Read the article

  • Is C# 4.0 Tuple covariant

    - by RichK
    (I would check this out for myself, but I don't have VS2010 (yet)) Say I have 2 base interfaces: IBaseModelInterface IBaseViewInterface And 2 interfaces realizing those: ISubModelInterface : IBaseModelInterface ISubViewInterface : IBaseViewInterface If I define a Tuple<IBaseModelInterface, IBaseViewInterface> I would like to set that based on the result of a factory that returns Tuple<ISubModelInterface, ISubViewInterface>. In C# 3 I can't do this even though the sub interfaces realize the base interfaces. And I'm pretty sure C# 4 lets me do this if I was using IEnumerable<IBaseModelInterface> because it's now defined with the in keyword to allow covariance. So does Tuple allow me to do this? From what (little) I understand, covariance is only allowed on interfaces, so does that mean there needs to be an ITuple<T1, T2> interface? Does this exist?

    Read the article

  • What are the 'best' XNA developed games for PC?

    - by RichK
    I've had a quick google, but can't find anything obvious that answers the question. What are the best games developed using XNA for PC? Any flagship games, original games.. etc? Obviously 'best' is pretty subjective, but I'm sure they'll be a common consensus on some of the good ones. (I don't own an XBox (if that matters...))

    Read the article

  • Looping through a method without for/foreach/while

    - by RichK
    Is there a way of calling a method/lines of code multiple times not using a for/foreach/while loop? For example, if I were to use to for loop: int numberOfIterations = 6; for(int i = 0; i < numberOfIterations; i++) { DoSomething(); SomeProperty = true; } The lines of code I'm calling don't use 'i' and in my opinion the whole loop declaration hides what I'm trying to do. This is the same for a foreach. I was wondering if there's a looping statement I can use that looks something like: do(6) { DoSomething(); SomeProperty = true; } It's really clear that I just want to execute that code 6 times and there's no noise involving index instantiating and adding 1 to some arbitrary variable. As a learning exercise I have written a static class and method: Do.Multiple(int iterations, Action action) Which works but scores very highly on the pretentious scale and I'm sure my peers wouldn't approve. I'm probably just being picky and a for loop is certainly the most recognisable, but as a learning point I was just wondering if there (cleaner) alternatives. Thanks. (I've had a look at this thread, but it's not quite the same) http://stackoverflow.com/questions/2248985/using-ienumerable-without-foreach-loop

    Read the article

  • Learn C++ after learning C#

    - by RichK
    I'm developing a library in C# at the moment and recently bought a great book to help me out but the code snippets are in C++. Does anyone have a link to a site/PDF that'll give me a crash course in C++? (mainly the syntax rather than pros/cons etc) because I'll be developing in C# but things like -, ::, &, **, are giving me the shivers. Obviously the languages aren't 100% compatible but if I know what the C++ is doing from a 'theoretical' point of view I can make a stab at rewriting it in C#. I've had a Google to find the answer but all the sites seem to be "Should I use C++ or C#?", which isn't any good to me. Thanks in advance.

    Read the article

1