Before:
public static class Calculator
{
public static int Add(
int numberOne,
int numberTwo,
int numberThree,
int numberFour,
int numberFive)
var containers = new[] | |
{ | |
new Container { Value = "bag" }, | |
new Container { Value = "bed" }, | |
new Container { Value = "car" } | |
}; | |
var filteredResults = | |
containers.Where(container => container.Value.Contains("a")) |
using System; | |
using System.Linq; | |
namespace ConsoleApplication10 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine(EncryptText("THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG")); |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
namespace ConsoleApplication9 | |
{ | |
class Program | |
{ | |
static void Main() | |
{ |
Before:
public static class Calculator
{
public static int Add(
int numberOne,
int numberTwo,
int numberThree,
int numberFour,
int numberFive)
public static class ExtensionMethod | |
{ | |
public static void SetValue<T>( | |
this T target, | |
Expression<Func<T, object>> expression, object value) where T : Control | |
{ | |
var memberExpression = expression.Body as MemberExpression; | |
if (memberExpression != null) | |
{ | |
var property = memberExpression.Member as PropertyInfo; |
open System | |
let highLowGame () = | |
let rng = new Random() | |
let secretNumber = rng.Next() % 100 | |
let rec highLowGameStep () = | |
printfn "Guess the secret number:" | |
let guessStr = Console.ReadLine() |
case "1": | |
Console.WriteLine("Select which of the following to add to cart by entering it's number:"); | |
foreach (var product in result) | |
{ | |
Console.WriteLine(" {0}. {1}, Stock: {2}, Price: {3}", product.RecordNumber, product.Name, product.Stock, product.Price); | |
} | |
int ProductInput = Convert.ToInt32(Console.ReadLine()); | |
// answer.. |
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) | |
{ | |
var converter = new HotkeyConverter(); | |
var keys = (value == null) ? Keys.None : (Keys) converter.ConvertTo(value, typeof(Keys)); | |
value = base.EditValue(context, provider, keys); | |
return converter.ConvertFrom(value); | |
} |
internal class HotkeyConverter : KeysConverter | |
{ | |
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destination | |
{ | |
if (destinationType == typeof(Keys)) | |
{ | |
Hotkey hotkey = (Hotkey) value; | |
if (hotkey != null) | |
{ |
Should I unit test the repository and the controller? I probably only need to verify that the already-tested | |
repository has been called into. | |
Should I test All_ReturnsAll and All_OrdersByPublish date or just the former? |