This file contains 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
/// <summary> | |
/// Custom function to perform looping operation. | |
/// </summary> | |
/// <typeparam name="T">type of ienumerable</typeparam> | |
/// <param name="list">The list.</param> | |
/// <param name="action">The action.</param> | |
/// <returns>index value</returns> | |
/// <exception cref="System.ArgumentNullException"> if the supplied action is null</exception> | |
public static int ForEach<T>(this IEnumerable<T> list, Action<int, T> action) | |
{ |
This file contains 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
using System; | |
using System.ComponentModel; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Runtime.InteropServices; | |
using System.Security; | |
namespace Shared.ApplicationLoaderUtil | |
{ | |
/// <summary> |
This file contains 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
/// <summary> | |
/// Gets the error message attribute. | |
/// </summary> | |
/// <param name="memberName">Name of the member.</param> | |
/// <returns> | |
/// value of attribute from class | |
/// </returns> | |
public static string GetErrorMessageAttributeValue(string memberName) | |
{ | |
string message = string.Empty; |
This file contains 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
public static void Usage() | |
{ | |
var instance = new Timer(); | |
// check if the event is assigned a handler | |
if (GetEventHandler(instance, "Elapsed", "ElapsedEventHandler") == null) | |
{ | |
throw new InvalidOperationException(string.Format("The Timer elapsed event must be assigned an event handler. Source: {0}", type.FullName)); | |
} |
This file contains 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
1. Stub() defines the behavior for stubbed object. | |
2. Expect() defines the behavior and the expectation for mocked object. | |
3. Follow the principle of "Test only one thing per test". | |
4. mockrepositoryObject doesn't stop recording until you call ReplayAll. Try using repositoryInstance.PlayBack(); | |
sample: | |
using (repository.Playback()) | |
{ | |
} | |
5. Call repository.VerfiyAll() in the end. |
This file contains 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
using System; | |
using System.Configuration; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Net.Http.Headers; | |
using System.Reflection; | |
using System.Web; | |
using System.Web.Http; |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Security; | |
using System.Reflection; | |
using System.Security.Cryptography.X509Certificates; | |
using System.Text; |
This file contains 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
/// <summary> | |
/// DoAsync is a method template to perform any task asynchronously. | |
/// </summary> | |
/// <typeparam name="T">type of argument</typeparam> | |
/// <param name="action">method</param> | |
/// <param name="argument">value of argument of type T</param> | |
public static void DoAsync<T>(Action<T> action, T argument) | |
{ | |
// Invoke the task to execute the item | |
Task.Factory.StartNew(() => action.Invoke(argument), |
This file contains 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
Testing websites: | |
http://www.regex101.com/r/yM3vL0 | |
http://www.regexplanet.com/advanced/dotnet/index.html | |
UrlSourceOrLocalDriveWithRegex = @"(?i)\b^(https?|s?ftp)+:\/\/[aA-zZ]*[0-9]*|([aA-zZ]{1}:{1}\\{1}\b).*$"; | |
Matches: Https://www.something.com, Ftp://somesource.com, sftp://securesource.com, http://moreurl.com, C:\path etc. | |
Unmatch: httpss://something.com, abcd://, c:, C, | |
SystemDriveOrUNCPathRegex = @"^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*.*))+$" | |
Matches: c:\folder, \\server\folder |
This file contains 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
var tempTable = $('#tbl').clone(true); | |
var tableBody = $(tempTable).children(); | |
$(tableBody).children().each(function(index , item){ | |
var currentRow = item; | |
$(currentRow).children().each(function(index1, item1){ | |
if($(item1).attr("rowspan")) | |
{ | |
// copy the cell | |
var item2 = $(item1).clone(true); | |
// Remove rowspan |
OlderNewer