|
Welll, I'm more interested in the TDD stuff - I threw in the XP and agile thing so everyone was aware of what I skipped.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Mark Nischalke wrote: The author really seemed to be saying that XP was the cure to all evils and nothing else could be used to write good software, no other methods used iterative delivery, etc.. His view also was that XP was an all or nothing thing, you either implemented in all, including paired programming, or it wouldn't work.
While he may be right or wrong, XP is not Agile. It is only one particular agile methodology.
If you really want to know what the intention of agile is you go the horses mouth.[^]
AM is an attitude, not a prescriptive process.
led mike
|
|
|
|
|
led mike wrote: AM is an attitude, not a prescriptive process.
Yeah, thats where I've seen a lot of people go wrong with many of the methodologies. It's not about checking off on a line item, behavior has to change also.
led mike wrote: the horses mouth
Why did I have thoughts of a link to a Mr. Ed site?
only two letters away from being an asset
|
|
|
|
|
John Simmons / outlaw programmer wrote: It seems to me that it's only real purpose is to test discrete functions and classes
NUnit can be used to test your whole application, but just parts of it at a time. Unit testing doesn't work for integration tests or tests where you want to see if 2 or more components work well together. Unit testing is just that: testing a unit at a time. In practical sense, this means testing a single method at time.
There are some barriers to unit testing: if you've mixed logic code in your GUI classes, unit testing them may cause your forms and controls to show up during the unit test runs, slowing things down and making testing a real pain. That's bad. Separate your logic from your GUI and you'll be good. Then you don't write unit tests for your GUI classes since there's no logic to be tested.
Another barrier to unit testing is hard-coded dependencies on the file system, the network, databases, etc. For example, if you've got a function that should open a connection to a database, and you want to test that the database is opened, you're in a predicament: your test can actually open the database, but that can slow down unit tests and it might not work if run on certain machines. Instead of opening a real database, make your code flexible enough so that there's no hard-coded dependency on your database:
void OpenTheDatabase()
{
someSqlConnection.Open();
}
void OpenTheDatabase(IDbConnection connection)
{
connection.Open();
} Here you injec a connection object, which could be a dummy object you create in your tests:
[Test]
public void OpenTheDatabaseDoesExactlyThat()
{
DummyConnection connection = new DummyConnection();
myDataLayer.OpenTheDatabase(connection);
Assert.IsTrue(connection.Opened);
}
class DummyConnection : IDbConnection
{
public bool Opened = false;
public void Open()
{
opened = true;
}
} Ah, now your test doesn't actually talk to a database during the unit tests.
It's a contrieved example, sure, but you get the idea: replace hard-coded dependencies with fake objects. For a better example, see Martin Fowler's Dependency Injection[^] article.
Now, once you've done a few unit tests like this, you begin to realize it's really a pain to have to create dummy classes like our DummyConnection every dang time you want to replace a dependency with a fake object.
Fortunately, there are some real great pieces of code out there, mocking frameworks, that take care of this for you. At my job we use a free one called RhinoMocks[^]. With it, replacing dependencies with fake objects becomes a breeze:
[Test]
public void OpenTheDatabaseDoesExactlyThat()
{
using (rhinoMocks.Record())
{
IDbConnection fakeConnection = rhinoMocks.CreateMock<IDbConnection>();
fakeConnection.Open();
}
using (rhinoMocks.Playback())
{
myDataLayer.OpenTheDatabase(connection);
}
} Notice in the above example, there is no DummyClass we had to create. Also notice we didn't have to Assert that Open() was called on the IDbConnection object -- we just told RhinoMocks we were expecting connection.Open to be called, and that was it.
John Simmons / outlaw programmer wrote: but what about adding nUnit to existing code?
You mean unit testing already-written code? Since that code's probably gonna be hard to test, it's gonna be hard to do. Skip the elementary nUnit and go for something more powerful. TypeMock[^] allows you to unit test existing codebases that weren't built with unit testing in mind. (It's so powerful, some people look down on it[^] because it allows you to write code the "old" way: hard-coded dependencies, tight coupling, etc. and still do unit tests.)
John Simmons / outlaw programmer wrote: TDD makes a lot more sense in theory because you have to have a good design up front in order to write applicable/viable tests
Precisely. It makes you essentially write blue prints for your code before actually writing the code. If you've got tests like ListensForUserModification(), SavesToDatabaseWhenClosing(), you've got a blueprint for how your code should work, and you've already put some thought into the design before actually writing code.
|
|
|
|
|
Heres one for you all.
I need to get info out of the data base by status and the current week. This is not a problem except for that the Week needs to begin on Thursday at 5:00pm and end on Thursday at 4:59pm.
I suppose my Question is how do I set this time as my week?
|
|
|
|
|
|
Hi
I need to control Visual Studio outside of the environment (create solutions, build solutions etc) from a C# application and was going to go down the route of generating the solution and project files in code and just changing the bits I need to. However I have been reading about the VS automation model which has all the functionality to do what I need.
It appears to be for extending the environment. Is there a way interacting with Visual Studio the way you would use a COM component or does the automation model offer this and I dont realise it?
Thanks
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
Well you can certainly build solutions from external apps like nant or msbuild does.
Why do you need to create solutions from an external application?
led mike
|
|
|
|
|
I am nearing completion of a a game making tool for my final year university project.
I have the tool creating the code files but at the moment the user would have to open Visual Studio add the files to an XNA project and then build it - the idea of the tool is that no coding is needed so I would like to hide all this from the user.
Thanks for your help I will look into those.
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
Hey
Thanks for your help - msbuild does exactly what I want!!!
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
hi,
I want to customize combo box such that what ever user enters in to it should appear in upper case. Please let me know
Thank You
*** Why EXPERTS behave like a fool ***
|
|
|
|
|
Hi,
there is a TextChanged event; you could attach a handler that replaces the entire
text by its uppercase equivalent.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thank u luc pattyn ....
I have not followed your idea
I have written this in the keypress event and it worked
string str = e.KeyChar.ToString().ToUpper();
char[] ch = str.ToCharArray();
e.KeyChar = ch[0];
Regards
Sidnhu Tiwari
*** Why EXPERTS behave like a fool ***
|
|
|
|
|
Hi,
yes that works for keyboard input, but not for pasted data (CTRL/V).
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Is there a way to allocate disk space before copying a file in c#?
sample code will be greate help
Thanks
|
|
|
|
|
Are you talking about ensuring there is enough space on the disk to store the file?
Obviously, if there isn't enough space, any attempt to save it will throw an exception. You would have you free up sufficient space manually.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi,
haven't done this for a long time, but I would try and create a file, write a byte,
seek to the intended file size and write another byte; then you could rewind and
write the actual data, or close and overwrite any way you choose.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
What is the exception thrown when another thread tried to access another control which its not given the right to??
Som
|
|
|
|
|
You can check all these yourself easily enough mate...
If you want to find out the exceptions a class throws then visit MSDN and look it up there, or you can simulate the exception and it will tell you the name of it when the program crashes.
Mark.
|
|
|
|
|
hi,
i want to set the column width of DataGrid, but i dunno how to do?
because i'm not using TableStyles
codes :
DataTable DT = new DataTable();
dataGrid1.DataSource = DT;
now, how can i set width of first column ???
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Get to the dataGrid1.Columns[i] or dataGrid1.Column["name"] and set its width?
|
|
|
|
|
no, its not so easy, there is no Property named Columns in DataGrid
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Urg, now I remember why I always use TableStyles in DG.
|
|
|
|
|
Just do this :dataGridView1.Columns[1].Width=X;",Maybe that's what you'll do.
Always do you best,what you plant you will harvest
later!
modified on Friday, March 21, 2008 4:54 AM
|
|
|
|
|
No, my question is about DataGrid not DataGridView
harry~ wrote: We can't change the first column's width sometimes
hehe, why?? i can change any of DGV
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|