Search Results

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

Page 1/1 | 1 

  • How to handle similar items in rails MVC?

    - by mocker
    I'm working on building a pretty simple site mainly as an exercise in learning more about rails. You can see my rough progress at statific.com. It's working pretty much as I wanted it for keeping track of server information, but now I'd like to expand it to other things, next on the list being firewalls. I can pretty easily duplicate all the models, views, etc.. that I have for my servers. The problem I see with that is that it isn't very DRY since most of the code would look the same, the only difference would be the attributes I have setup for firewalls would be different than for servers. I know in plain ruby this is pretty simple, you can have a 'Product' w/ common attributes ('manufacturer', 'model') and then have children with more specific attributes. Does the same type of concept exist for rails, or am I just over thinking this?

    Read the article

  • Moq a function with 5+ parameters and access invocation arguments.

    - by beerncircus
    I have a function I want to Moq. The problem is that it takes 5 parameters. The framework only contains Action<T1,T2,T3,T4> and Moq's generic CallBack() only overloads Action and the four generic versions. Is there an elegant workaround for this? This is what I want to do: public class Filter : IFilter { public int Filter(int i1, int i2, int i3, int i4, int i5){return 0;} } //Moq code: var mocker = new Mock<IFilter>(); mocker.Setup(x => x.Filter( It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()) .Callback ( (int i1, int i2, int i3, int i4, int i5) => i1 * 2 ); Moq doesn't allow this because there is no generic Action that takes 5+ parameters. I've resorted to making my own stub. Obviously, it would be better to use Moq with all of its verifications, etc.

    Read the article

1