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
MERGE INTO Lookups AS Target | |
USING (VALUES | |
(0, N'Lookup Number 0'), | |
(1, N'Lookup Number 1'), | |
(2, N'Lookup Number 2'), | |
(3, N'Lookup Number 3'), | |
(4, N'Lookup Number 4'), | |
(5, N'Lookup Number 5'), | |
(6, N'Lookup Number 6') | |
) |
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 ActionResult Index(InputModel model) | |
{ | |
return Json(new | |
{ | |
total = 1234, | |
page = 1, | |
rows = new List | |
{ | |
new | |
{ |
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
[Test] | |
public void SomeTest() | |
{ | |
var viewResult = this.controller.Index(new InputModelBuilder().Build()) as JsonResult; | |
viewResult.Should().NotBeNull(); | |
var data = viewResult.Data; | |
var pageNumber = data.GetType().GetProperty("page").GetValue(data, null); |
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
private object GetValue(object source, string propertyName) | |
{ | |
return source.GetType().GetProperty(propertyName).GetValue(source, null); | |
} |
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
this.GetValue(data, "page").Should().Be(1); |
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 rows = (List<object><p> | |
)data.GetType().GetProperty("rows").GetValue(data, null); | |
rows.Count.Should().Be(1); | |
this.GetValue(rows[0], "id").Should().Be("98732312"); | |
var cell = rows[0].GetType().GetProperty("cell").GetValue(rows[0], null); | |
this.GetValue(cell, "prop1").Should().Be("a"); |
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
@echo off | |
echo Pre req checks... | |
echo|set /p=... Running as ADMIN ... | |
reg query "HKU\S-1-5-19" >nul 2>&1 | |
if %errorlevel% == 1 echo FAILED : Not runing as ADMIN | |
if %errorlevel% == 0 echo Passed | |
echo|set /p=... SQL Server ... | |
osql.exe -? >nul 2>&1 |
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 SomeViewModelBinder : DefaultModelBinder | |
{ | |
public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) | |
{ | |
int currentPage = 1; | |
int itemsPerPage = 8; | |
var page = bindingContext.ValueProvider.GetValue("page"); | |
if (page != null) |
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
[Test] | |
public void ShouldReturnModelWithValuesSetCorrectly() | |
{ | |
var formCollection = new NameValueCollection | |
{ | |
{ "page", "5" }, | |
{ "rp", "8" }, | |
{ "query", "smith" }, | |
{ "sortname", "sname" }, | |
{ "sortorder", "sorder" } |
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
/// A description of the regular expression: | |
/// | |
/// Beginning of line or string | |
/// [1]: A numbered capture group. [[^[].*[^]]] | |
/// [^[].*[^]] | |
/// Any character that is NOT in this class: [[] | |
/// Any character, any number of repetitions | |
/// Any character that is NOT in this class: []] | |
/// End of line or string |
OlderNewer