Posts
My First Post Using Windows Live Writer
I came to know about this cool writer very recently and was waiting to take a look at this editor. Now that I am writing a blog entry from this editor, I feel like its really making my life easy.
Well, for a head start, I just hit the print screen button followed by a ctrl-V and this is what you see! It's lot more fun to edit in this editor!
Posts
My MCTS Certification
Today I have appeared at the MCTS Exam # 70-528 (Web Based Client Development) and successfully passed the exam. I also appeared at another exam # 70-536 (Microsoft .Net Framework) and successfully passed in that exam too.
Although, I haven't got the MCP website access information yet, I can now possibly be called a 'Microsoft Certified Technology Specialist'!
Posts
A solution to the problem with creating mocks for interfaces with Generic Methods with NMock
I was so happy with NMock to see how it can dynamically generate mocks of interfaces and also gives me a fluent interface to write expectations and everything it does to help me in unit testing!
However, I could not generate dynamic mocks for interfaces with Generic methods and it kept showing me the 'TypeLoadException' on and on. My interface looks like the following -
interface IObjectFactory
{
T GetObject(string id);
Posts
Verify Correct DateTime data in method call using NMock
Recently I was writing unit test for a method of the following signature
interface ICache
{
void Insert(string key, object value, DateTime absoluteExpiration, TimeSpan slidingExpiration);
}
and I wanted to verify the following call -
Insert("key", "value", DateTime.Now.AddMinutes(30), TimeSpan.Zero);
However, you readily see the problem in verifying with the above call for the presence of DateTime.Now.AddMinutes(30) in the argument. So, a test method like the following won't work for obvious reason.
Posts
Mock Internal Interface with NMock2 - Use InternalsVisibleToAttribute
Yesterday I badly needed to create mocks for my internal interfaces. I am using NMock2 as a Mocking framework and found it really difficult to produce Mocks for internal interfaces. After some 'google time' and investigation I found that you need the following two lines in your AssemblyInfo.cs to achieve this purpose-
[assembly: InternalsVisibleTo("Mocks")]
[assembly: InternalsVisibleTo("MockObjects")]
Where are the two assemblies? I found that these two assemblies are dynamically created by NMock2 for mocking your interfaces.
Posts
Unity - A Dependency Injection framework from Microsoft Patterns and Practices
I have been using Spring.Net for implementing Dependency Injection in my .Net projects. Spring is already one of the most known providers of DI in the Java world and a port to .Net actually eased the lives of people like me who are willing to develop unit-testable software.
However, with all the happiness enjoyed through Spring.Net, I guess its time to take a look into Unity. I have only started using this and I found it interesting in the sense that its more of .
Posts
Testing Internal Class in .Net C#
I have been to a situation where only a small number of classes had been declared as public classes in an assembly. And most of the classes are declared as internal, because I wanted to expose only the public classes to the consumers of my assembly.
However, doing so creates another challenge in testing the internal classes. As we most commonly want our test codes to reside on a separate assembly so that we can leave that assembly out when we are releasing the end product.
Posts
What does a Scrum Master really do?
Hmm! I am now a CSM (Certified Scrum Master) after two days of training with CST Pette Deemer.
You want to congratulate me! Lets congratulate me first-
You: Congratulations! It's really a great news! How does it feel to be a CSM?
Me: Greaaaaaaaat! You know, its so cool that my profile gets a CSM on it!
You: Oh Sohan! I am so sure that you will contribute more at the company?
Posts
Preserve Ownership, mode and other attributes while copying in Linux
I dare not say, I am savvy at Linux :-)
Recently, I ran into a problem where I found that upon executing a copy command, my source and destination files had different permissions and attributes (i-nodes), but I badly needed the permissions to be preserved in the destination files/folders. The following command will preserve the attributes -
cp -p source destination here, the switch p (-p) does the trick, it preserves the permissions, modes and other attributes to resemble the source.
Posts
C# keyword 'yield return' - I find it interesting
I have been using yield return in some of my codes and would like to share its interesting aspects. The following code example shows one dummy use of 'yield return'-
public class YieldExample
{
public void Run()
{
IEnumerator numbers = getNumbers().GetEnumerator();
while (numbers.MoveNext())
{ Console.Write("x{0} ", numbers.Current);
}
}
private IEnumerable getNumbers()
{
for (int i = 0; i <>
Now, a code like new YieldExample().Run() would produce a output similar to this - "