Format:
Recent snippets for: Cat
<script type="text/javascript"> function CustomValidatorOmbudsmanNotifiedDate(s, args) { var dt = args.Value if (!dt && $("*[id$='OmbudsmanNotifiedFlag'] input:checked").val() == '1') { args.IsValid = false; } else { args.IsValid = true;
46 Views
no comments
public static IEnumerable<Orders> ExcludeOrderTypes(this IEnumerable<Orders> orders, int[] orderTypeIdsToExclude) { if ((orders == null || orders.Count == 0)) { return new List<Orders>(); } if ((orderTypeIdsToExclude == null)) { return orders; }
33 Views
no comments
// Format names as one comma delimited string var names = string.Join(", ", (from p in people select d.Name).ToArray());
50 Views
no comments
public void IterateMethod(Dictionary<string, object>() items) { // or var foreach (KeyValuePair<string, object> item in items) { // do something with item } }
104 Views
no comments
public void Go() { for (int i = 0; i < 100; i++) { WaitCallback wcb = new WaitCallback(this.DoWork); ThreadPool.QueueUserWorkItem(wcb, i); } Console.ReadLine(); }
122 Views
no comments
/// <summary> /// Check that Close is called on the View when called on presenter and screen is not dirty /// new AAA syntax /// </summary> [Test] public void When_the_screen_is_not_dirty_can_close_AAA() { // 1. Arrange var view = MockRepository.GenerateMock<IHumbleView>(); view.Stub(x => x.IsDirty).Return(false);
195 Views
no comments
public interface IView { event EventHandler Load; } public class Presenter { private IView _View; public Presenter(IView view)
194 Views
no comments
/// <summary>
/// Subject under test = InvoiceSender
/// Want to verify that the IEmailService.Send(MailMessage) method is being called from SendInvoice(float, string)
/// </summary>
[Test]
public void SendInvoiceUsingEmailService_RecordReplay()
{
var mocks = new MockRepository();
// dependency
var mockEmailService = mocks.DynamicMock<IEmailService>();
111 Views
no comments
[TestFixture] public class LogAnalyzerTests { /// <summary> /// using old Record / Replay syntax /// Class under test = LogAnalyzer /// Want to verify that the IWebService.LogError(filename too short) method is being called from LogAnalyzer.Analyze(filename) /// </summary> [Test]
201 Views
no comments
var customEditControls = new Dictionary<GridColumn, RepositoryItem>() { {colCountry, reposCountry}, {colCountry_Code, reposCountryCode}, {colState, reposState}, {colState_Code, reposStateCode}, {colBuilding_Scheme, reposBuldingScheme}, {colBuilding_Class, reposBuildingClass}, {colOccupancy_Scheme, reposOccupancyScheme}, {colOccupancy_Code, reposOccupancyCode}
136 Views
no comments
// record/replay [Test] public void Test() { //Setup ISth sth= mocks.DynamicMock<ISth>(); //Expectations Expect.Call(sth.A()).Return("sth");
153 Views
no comments
public static class TypeHelper { /// <summary> /// Extension method: Create a new generic list of anonymous type at runtime from passed in array /// </summary> /// <typeparam name="T"></typeparam> /// <param name="t"></param> /// <returns></returns> public static List<T> TypeGenerator<T>(this T[] t) {
98 Views
no comments
// 3.5: var radioGroups = this.Controls.OfType<RadioGroup>().ToList(); // old way using recursion: var radioGroups = GetAllRadioGroups(this.Controls); /// <summary> /// Return a list of radiogroup controls within the current controls collection, recursively /// </summary> /// <param name="controls"></param>
172 Views
no comments
/************************************************************/ /* Set expectations for a method to be called only once */ /************************************************************/ // NMock: Expect.Once.On(mockLookupList).Method("Clear"); // Rhino Mocks mockLookupList.Expect(x => x.Clear()).Repeat.Once(); /************************************************************/
188 Views
no comments
var results = from e in exposureGrouping group e by new { e.Category, e.Area } into g orderby g.Key.Category, g.Key.Area select new WorldwideExposure { Category = g.Key.Category, Area = g.Key.Area, Open_Market = g.Where(x => x.ClassCode == "OM").Sum(x => x.Usd_Gross_Exposure), North_American_Binders = g.Where(x => x.ClassCode == "NA").Sum(x => x.Usd_Gross_Exposure),
551 Views
no comments
var groupedResults = from r in results group r by r.Category into g select new { Category = g.Key, Results = g };
265 Views
no comments
private delegate void PopulateReport(Report report); public void GenerateReports() { Report report1 = new Report("First Report"); DisplayReport(PopulateFirstReportMethod, report1); Report report2 = new Report("Second Report"); DisplayReport(PopulateSecondReportMethod, report2); }
169 Views
no comments
var list = new PolicyPerilService() .GetAll() .Select(item => new { Code = item.Code, Description = item.Description}) .ToList();
311 Views
no comments
enum ReportTypes { Country, CountryState, CountryStateZone, CountryStatePostCode, CountryZone, CountryStateCounty } var reportTypes = new Dictionary<int, string> () { {(int)ReportType.Country, "By Country"}, {(int)ReportType.CountryState, "By Country, State"}, {(int)ReportType.CountryStateZone, "By Country, State, Zone"},
425 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
