[dba-VB] C#: Did you know - private fields ...

Salakhetdinov Shamil mcp2004 at mail.ru
Thu Jun 28 12:01:40 CDT 2012


Hi Gustav --

My pleasure! :)

-- Shamil


Thu, 28 Jun 2012 13:29:56 +0200 от "Gustav Brock" <gustav at cactus.dk>:
 
  
  
Hi Shamil

That's very kind of you!
Once again you can keep me busy for days.

Indeed, TestDriven.Net seems what I was looking for without knowing it.

/gustav


>>> Salakhetdinov Shamil <mcp2004 at mail.ru> 28-06-12 11:22 >>>
Hi Gustav --

I have replied to you yesterday here but my message didn't get through - it was waiting of this list moderators approval because of its length. So I have dropped it this afternoon and I'm trying to repost it split into two parts:

---- PART I -----

Hi Gustav --
1. You can start immediately from tests you can find in:
NorthwindTranslationTests.cs
NorthwindExecutionTests.cs
NorthwindCUDTests.cs
For example delete all code from IQToolkit.Data.Access.Tests.Programs.cs.Main(...) method and put in it the following code lines:
NorthwindTranslationTests o = new NorthwindTranslationTests();
NorthwindTranslationTests.Initialize();
o.TestWhere();
NorthwindTranslationTests.Cleanup();
(in fact you have that code lines there commented - just comment other stuff and uncomment the code lines as I've written above)
Set breakpoint in TestWhere() test method
public void TestWhere()
{
TestQuery(db.Customers.Where(c => c.City == "London"));
}
run (F5) and then you can drill-down into test helper code and IQToolKit sources usual way using VS' Step-Into (F11) debugging/tracing functionality etc.
IOW you don't need to know anything about TDD to start investigating IQToolkit.
Please don't make a "religious practice" from TDD (and don't be afraid you'll need a lengthy "religious preparations/introduction" to start using TDD") - TDD is only a development practice - and the way you'll apply it in your own context depends on your preferences (see below references on stuff to read about TDD practices while you can keep investigating IQToolkit sources usual "TDD-free" way)
2. Get and setup NUnit (any version) - in the sample project v. 2.5.10 is used. 
You can use the latest version but you'll have to change the reference in the test project.
Download (all versions): http://www.nunit.org/index.php?p=download
Getting Started (2.5.10): http://www.nunit.org/index.php?p=quickStart&r=2.5.10
3. Get & setup the VS add-in/tool from http://www.testdriven.net/
 It's free for non-commercail use.
When you'll get it installed (I assume you have already NUnut (any version installed)) you'll be able to right-click on any test method (marked with [Test] attribute) and run it getting test output in VS 'Output' window.
You can even right-click on the test class (marked with [TestFixture]) attribute and you'll get all the test run and their output written into VS Output window - you can see such an output I have got by running whole test suites and putting all their output in the bottom of their code files,e g.:

------ Test started: Assembly: IQToolkit.Data.Access.Tests.exe ------
Test 'Test.NorthwindCUDTests.TestBatchUpsertNewCustomersNoResultAsync' failed: 
 Expected: True
But was: False
TestBase.cs(298,0): at Test.TestBase.AssertTrue(Boolean value)
NorthwindCUDTests.cs(833,0): at Test.NorthwindCUDTests.TestBatchUpsertNewCustomersNoResultAsync()
...
72 passed, 3 failed, 0 skipped, took 29.71 seconds (NUnit 2.5.5).

---- to be continued ---*


Wed, 27 Jun 2012 18:00:43 +0200 от "Gustav Brock" <gustav at cactus.dk>:
 
  
  
Hi Shamil

OK, I've got the code installed and it delivers to the console window, but I can see that I will not make any progress before I have studied that blog (below).

Also, NUnit is installed but I haven't used testing before, and the guide seems to contain code for old versions, not the current version. Further, the "Get started" guide opens with an example it claims is not very good ... very useful(?).

So do you - or anyone - know of a good guide to unit testing and NUnit current version?

/gustav

<<< skipped >>>
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com



_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com

    


More information about the dba-VB mailing list