Created
December 26, 2015 17:47
-
-
Save miklund/a51466be24d5f5876d5f to your computer and use it in GitHub Desktop.
2009-05-29 The difference between member methods and extension methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Title: The difference between member methods and extension methods | |
# Author: Mikael Lundin | |
# Link: http://blog.mikaellundin.name/2009/05/29/the-difference-between-member-methods-and-extension-methods.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Written with MsTest as unit test framework | |
namespace LiteMedia | |
{ | |
using System; | |
using System.Linq; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
[TestClass] | |
public class VerifyClaim | |
{ | |
[TestMethod] | |
[ExpectedException(typeof(ArgumentNullException))] | |
public void FirstOrDefaultThrowsArgumentNullException() | |
{ | |
/* Setup */ | |
string[] names = null; | |
/* Test */ | |
names.FirstOrDefault(); | |
} | |
[TestMethod] | |
[ExpectedException(typeof(NullReferenceException))] | |
public void UsingClassMembersOnNullReferenceWillThrowNullReferenceException() | |
{ | |
/* Setup */ | |
string[] names = null; | |
/* Test */ | |
string fail = names.ToString(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment