The current time is

Showing posts with label "Visual Studio". Show all posts
Showing posts with label "Visual Studio". Show all posts

Thursday, August 06, 2009

Visual Studio 2005 Getting Latest while checking out... Feature or Bug !!!

Grrr...
Is this a FEATURE or an annoying aspect in VS 2005...???!!!

Visual SourceSafe and all the similar products are made for managing the "versioning" of files so that the whole team of developers can keep track of the latest versions of the files while they're working in a team...

In Visual Studio 2005, when a developer checks out a file to work on, the VS does not get latest for this file, but it just gives him/her access to modify it by flipping the right access from read only to read/write access. How about if some other colleague changed the contents of this file... If so, then one would have to merge the files when he/she's done... THAT is not a good version control system... One should always get access to modify a latest version of the file. Ain't I right???

I searched online to fix this issue and found this post (http://sela.co.il/?CategoryID=975&ArticleID=501&Page=1) which "says" it has the solution...

I hope it works for you... Let me know if it doesn't and if you've got other solutions to this problem... I hope you'd tell me about it too :)))

Tuesday, November 25, 2008

Writing a data-driven unit test

This was a really cool investigation…

It's all about one having a unit test case and it is required to run it using some number of data… An "easy" way out of this could be creating the same unit test case with different parameters every time. However, if one has enormous amount of data that should be tested on a specific method, he can create a unit test case and bind to it a datasource that is used by this test case.

Please follow the steps below:

  1. Create a new test Project (File New Test Project)
  2. Create a new method into the default class being created (Let us name it: TestTrimTexts())
  3. Above this method, you should write the code [TestMethod]
  4. To identify the datasource that would be used by this test method, you should write this line of code: [DataSource("System.Data.SqlClient", "Data Source=.\\OfficeServers;Initial Catalog=master;Integrated Security=SSPI;", "spt_values", DataAccessMethod.Sequential)]

    This instructs the CLR to use the table "spt_values" using the connection string "Data Source=.\\OfficeServers;Initial Catalog=master;Integrated Security=SSPI;" and the provider "System.Data.SqlClient". It also mentions that the data should be used sequentially.

    The most important part comes last, reading the data from the datasource just defined in the previous steps. You should add this pieace of code:


    Afterwards, inside the test method, TestTrimTexts(), you should use the TestContext.DataRow["name"] where it will contain data fetched from the datasource specified, the column named "name", in this case.

    Enjoy it then :)

    Notes: There is an overload for step number 4. Check the screen shot below:


    This overload had a small problem with me since it used data from the datasource randomly and this caused me to get frightened while debugging… I wasn't able to trace it with ease :)

References:

  1. http://msdn.microsoft.com/en-us/library/ms182528(VS.80).aspx
  2. http://msdn.microsoft.com/en-us/library/ms182527(VS.80).aspx
  3. http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.testcontext.datarow(VS.80).aspx

Tuesday, November 18, 2008

Installing Visio for Enterprise Architects without installing the prerequisite Visual Studio

Today I faced a problem while installing Visio (Enterprise Architects version) on my work machine... Tried searching the net for solutions, but didn't find much. However, I still believed there was a way... After more searching, I found this amazing wicked method... Follow me :)

Open the registry at the following key:
HKLM\Software\Microsoft\VisualStudio\8.0\Setup\VS\VSTD\

Of course, if you didn't find any part of this path, create it till the end...

Afterwards, inside VSTD, create a String key with name "ProductDir" and put any text inside it.

Voilaaa, VSTA installation will start like a sparky :)

Enjoy it till it lasts...