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 class MVCTestExtensions { | |
public static RouteData WithParameters(this RouteData route, object parameters) { | |
foreach (var property in parameters.GetType().GetProperties()) { | |
var value = property.GetValue(parameters, null); | |
route.Values[property.Name] = value; | |
} | |
return route; | |
} |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Operação completa</title> | |
<script language="javascript" type="text/javascript"> | |
function closeWindow() { | |
window.open('', '_self', ''); | |
window.close(); | |
} | |
</script> |
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 class ElmahUsersAttribute : ActionMethodSelectorAttribute { | |
public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo) { | |
//validate current user ~ true or false? | |
} | |
} | |
public class ElmahController : Controller { | |
[ElmahUsers]public ActionResult Index() { return new ElmahResult(); } | |
[ElmahUsers]public ActionResult Stylesheet() { return new ElmahResult("stylesheet"); } | |
[ElmahUsers]public ActionResult Rss() { return new ElmahResult("rss"); } |
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
"C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Publishing\1.4\SqlPubWiz.exe" |
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 Moq as usual | |
[Test] | |
public void EditItem_Post_WhenModelIsValid_ShouldRedirectToIndex() { | |
//Arrange | |
var shoppingCartStub = new Mock<IShoppingCartService>(); | |
shoppingCartStub.Setup(c => c.Change(It.IsAny<Guid>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<string>())); | |
var wcfServiceFactoryStub = new Mock<IWCFServiceFactory>(); | |
var controller = new BasketController(shoppingCartStub.Object, wcfServiceFactoryStub.Object); |
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
[TestFixture] | |
public class EncryptingDecryptingTests { | |
static byte[] GetBytes(string str) { | |
byte[] bytes = new byte[str.Length * sizeof(char)]; | |
System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length); | |
return bytes; | |
} | |
static string GetString(byte[] bytes) { |
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
if ! [ -t 0 ]; then | |
read -a ref | |
fi | |
IFS='/' read -ra REF <<< "${ref[2]}" | |
branch="${REF[2]}" | |
if [ "lfreneda_novo_b2c" == "$branch" ]; then | |
URL='http://10.30.0.51:8081/job/dev.ecommerce.newb2c/build?delay=0sec' | |
wget.exe $URL | |
fi |
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 class NoCacheAttribute : ActionFilterAttribute { | |
public override void OnResultExecuting(ResultExecutingContext filterContext) { | |
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1)); | |
filterContext.HttpContext.Response.Cache.SetValidUntilExpires(false); | |
filterContext.HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches); | |
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache); | |
filterContext.HttpContext.Response.Cache.SetNoStore(); | |
base.OnResultExecuting(filterContext); | |
} | |
} |
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
(function () { | |
var jQuery; | |
// If not present, load jquery | |
if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') { | |
createScriptReference("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", function () { | |
// Restore $ and window.jQuery to their previous values and store the | |
// new jQuery in our local jQuery variable | |
jQuery = window.jQuery.noConflict(true); | |
main(); | |
}); |
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
bcp "SELECT Line from db_WF_Log.dbo.tbLogs where Type = 'anticheat_report' and Processed = 0" queryout 'C:\temp\queryout.txt' -c -t, -S 10.30.0.51,1220 -T |