Rhino mocks 3.5 with Framework 4

18 בדצמבר 2010

I was migrating our projects to Framework 4 and when I tried to run tests I have realized that not all of them are running as expected, for most of the tests the exception was "Ambiguous match found" when Arg<MyType>.Matches(…) been used. I have fetch the web an realized the Rhino Arg type is facing some difficulties with Framework 4. The solution is updating Rhino version to 3.6 (download here).
63 תגובות

Logging Linq to SQL operations

1 בפברואר 2010

Linq to SQL provide build in logger that logs all select, insert, update and delete operations, it executes. Very helpful tool when something goes wrong. You can find it under DataContext .Log property that takes TextWriter . Most of the samples you probably would find about the logger are setting the Console.Out to it, like this: DataContext dataContext = newMyDataContext(); dataContext.Log = Console.Out; The more common scenario would be to write it to a text file. Changing this code to open a StreamWriter is not so hand: string logFilePath = @"c:\log.txt"; FileStream fileStream = new FileStream(logFilePath, FileMode.OpenOrCreate, FileAccess.Write); TextWriter textWriter =...
תגיות: ,
60 תגובות

Add configuration intelliSense for Unity Application Block

28 ביוני 2009

Unity Application Block is part of entLib 4.1, unfortunately its configuration section is not editable via entLib configuration editor. The editor probably will be updated in the next version of entLib 5.0, till then the best that we can do is add intelliSense to the configuration file.  First download the xsd file of Unity from http://www.codeplex.com/unitycontributions/SourceControl/PatchList.aspx and copy that to c:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas . After that go to your configuration file, open it for edit, open the properties, go to schemas and open the editor, check the use box for unoty.xsd After that you will be able to...
43 תגובות

Setting up subversion for visual studio

20 ביוני 2009

Subversion (AKA SVN) is good choice for source control if you don’t want to pay for licenses. For setting up the subversion source control for visual studio you need to do the following: 1) Install the subversion plug in - http://www.visualsvn.com/visualsvn/download/ 2) for more operation and user interface install - http://tortoisesvn.net/downloads 3) for the SVN repository you have couple of choices: a. Install one on your machine. Download and install the SVN server (http://www.visualsvn.com/server/). For this you have to be ready to do some extra install (like web server) and do...
אין תגובות

Validating Xml File Against XSD Schema

19 בפברואר 2008

Let the code talkpublic class XmlXsdValidator { private static bool _isValied = true; public static bool ValidateXmlAgainstXsdSchema(string xmlPath, string xsdPath) { try { XmlReader xsd = new XmlTextReader(xsdPath); XmlSchemaSet schema = new XmlSchemaSet(); schema.Add(null, xsd); ...
אין תגובות

Taking a shot to simplify Configuration Section using

14 בינואר 2008

  Configuration sections are our ability as developers to interfere in the structure of our configuration file and add some custom value in it. Yoav Michaely (my team mate) and I tried to make the use of it a little simpler. Our goals:1) Make easy use of configuration section instance2) To imitate the functionality of AppSetting of key value collection3) Maybe get some extra functionality in the way – how knows…? So let see out class declaration:public abstract class ConfigurationSectionBase<CurrentClass> : ConfigurationSection that would be our base configuration section class that will encapsulate some basic logic...
אין תגובות

MSTest task for MSBuild

16 בדצמבר 2007

  I was looking for an ability to run automated tests from MSBuild, my demands are: 1) Be able to run tests from many solutions (that contains many projects and many tests). 2) Be able to control the entire test running definition from one file(and not to open each proj file to add a new test every time someone in my team writes one). 3) Be able to separate sets of tests that take more time to run from those that run with no time – usually it will be divided into unit...
83 תגובות

Managing WCF service instances

24 בנובמבר 2007

When you first time run your WCF service (http://localhost/myCoolService.svc) you get a nice tutorial, made by Microsoft, that explain you how you should use the service. This is not hard to notice that you should close every connection you made to a service. Like this:MyServiceClient client = new MyServiceClient(); client.Close(); I am using a lot of services in my apps and I don’t want to kip in mind that all the time I am using a service instance I have to remember to close the connection. So I wrote a simple code that handles the closing for me. public class ServicesFactory : IDisposable { ...
אין תגובות