1
\$\begingroup\$

My question was closed and I haven't found any explanation as to why it was closed. According to FAQ, we can ask questions about best practices.

My question was about testing and my code did what it should do. I only want to find the better, more efficiency way to do it. That's what I understand under review. Do you have any explanation?

\$\endgroup\$
5
\$\begingroup\$

The FAQ requires that you are posting real code. But yours does not appear to be real code from your project.

If we look at your code:

Code is given without a class or function

GoodClass goodClass = new GoodClass(ohterClassMock);

GoodClass and otherClassMock seems to fake placeholder names

...

A section of code has been elided.

var contracts = new List<Contract>();
var contract = new Contract{ Id = 1, Param2 = 34 };

Param2 appears be a fake name

contracts.Add(contract);
var contract2 = new Contract { Id = 2, Param2 = 56 };
contracts.Add(contract2);

The fact that you are constructing objects like this strongly suggests its not production code. It could be a unit test or something

goodClass.DoSomething(contracts);

DoSomething looks to be a fake name

ohterClassMock.Verify(mock => mock.MethodToTest(It.IsAny<?contracts?>()));

MethodToTest is another placehold name. Is <?contracts?> real code? I don't use C# so I'm not sure.

So you've clearly not shown us your real code as required by the FAQ. If you want to us to help improve your code, you need show us your code. If you just want a specific abstract question answered, then its not on-topic here.

\$\endgroup\$
  • \$\begingroup\$ Its my real code from my real project \$\endgroup\$ – MikroDel Mar 19 '13 at 17:34
  • \$\begingroup\$ If you have missed some extra information - you could ask it in the comments - and not simply close the question and downvote it \$\endgroup\$ – MikroDel Mar 19 '13 at 17:36
  • \$\begingroup\$ Sure I cannot post my code from my workplace without change the names of the classes and varibles. But I Im not alone here who has such a restriction. And changed names are better to understand than the names from your domain. \$\endgroup\$ – MikroDel Mar 19 '13 at 17:39
  • 3
    \$\begingroup\$ @MikroDel, firstly, I had nothing to do with closing your question. I'm just explaining what I presume the people who did vote to close your question were thinking. So please don't get upset with me. \$\endgroup\$ – Winston Ewert Mar 19 '13 at 17:41
  • 3
    \$\begingroup\$ @MikroDel, if you want to argue that we should allow anonymized code, feel free to open a question on Meta asking for the policy to be changed. As it stands, the policy is that it must be actual code, and as moderator I have to enforce the policy, not just do whatever I want. But we are a democracy, and the policy is dictated by the community. \$\endgroup\$ – Winston Ewert Mar 19 '13 at 17:43
  • \$\begingroup\$ You are the moderator on this site. And Im upset in the moment with the art of communication here - closing without an explanation and even without some try to use such a feature as comments.. Im not say you a guilty :) But Im upset its true... \$\endgroup\$ – MikroDel Mar 19 '13 at 17:44
  • \$\begingroup\$ It not about anonymising the code... some of my variables was with the special information - to explain it - it had to post a lot of extra information. And my variables wasnt the english words... so I have changed it to english. \$\endgroup\$ – MikroDel Mar 19 '13 at 17:46
  • 1
    \$\begingroup\$ @MikroDel, I'm sorry you're upset. I know that having your question closed is a like a slap in the face. \$\endgroup\$ – Winston Ewert Mar 19 '13 at 17:46
  • \$\begingroup\$ I have open the feature-request meta.codereview.stackexchange.com/questions/695/… \$\endgroup\$ – MikroDel Mar 19 '13 at 17:50
  • \$\begingroup\$ Is it possible to reopen my question? Ill edit it to be FAQ-friendly. \$\endgroup\$ – MikroDel Mar 19 '13 at 17:51
  • 1
    \$\begingroup\$ @MikroDel, I've reopened it. \$\endgroup\$ – Winston Ewert Mar 19 '13 at 17:54
  • \$\begingroup\$ Thank you! :) but I cannot edit the question ) \$\endgroup\$ – MikroDel Mar 19 '13 at 18:07
  • 1
    \$\begingroup\$ @MikroDel, try again \$\endgroup\$ – Winston Ewert Mar 19 '13 at 18:10
  • \$\begingroup\$ thanks its work now :) \$\endgroup\$ – MikroDel Mar 19 '13 at 18:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .