This file contains hidden or 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 class ProductViewMapper : Mapper<Product, ProductView> | |
{ | |
public override void DefineMap(IConfiguration configuration) | |
{ | |
configuration.CreateMap<Product, ProductView>() | |
.ForMember(dest => dest.Name, opt => opt.MapFrom(orig => orig.Name + "WHOOPS")); | |
} | |
} |
This file contains hidden or 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
[Binding] | |
public class AccountSteps | |
{ | |
[BeforeScenario] | |
public void Setup() | |
{ | |
Database.Open().Accounts.DeleteAll(); | |
} | |
[Given(@"the following accounts exist")] |
This file contains hidden or 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
Scenario: Submit a valid create account form | |
Given the following accounts exist | |
| FirstName | LastName | Email | | |
| Howard | Roark | [email protected] | | |
When I submit the following Create Account form | |
| Field | Value | | |
| FirstName | John | | |
| LastName | Galt | | |
| Email | [email protected] | | |
Then the following accounts should exist |
This file contains hidden or 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 void Run() { | |
if (k.IsRegistered<IDummy>()) | |
k.Resolve<IDummy>().Do(); | |
else | |
throw new InvalidOperationException(string.Format("{0} couldn't find a dummy to practice on.", this.Name)); | |
} |
This file contains hidden or 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
Feature: Loose Guids | |
Scenario: Sample loose guid | |
Given the account repository has the following accounts | |
| Id | LastName | | |
| 1 | Galt | | |
| 2 | Roark | | |
When I press the delete account '1' button | |
Then I should have the following accounts | |
| Id | LastName | |
This file contains hidden or 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 AutoMoq; | |
using NUnit.Framework; | |
namespace TestProject1 | |
{ | |
[TestFixture] | |
public class UnitTest1 | |
{ | |
private AutoMoqer mocker; | |
private SomeController controller; |
This file contains hidden or 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
<% Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> | |
<%@ Import Namespace="System.Linq" %> | |
<% | |
var items = ViewData.ModelMetadata.AdditionalValues["SelectList"] as IList<SelectListItem>; | |
<select id="<%=ViewData.ModelMetadata.PropertyName %>" name="<%=ViewData.ModelMetadata.PropertyName %>" <%=(ViewData.ModelState.ContainsKey(ViewData.ModelMetadata.PropertyName) && ViewData.ModelState[ViewData.ModelMetadata.PropertyName].Errors.Any()) ? "class=\"input-validation-error\"" : string.Empty %>> | |
<%foreach (var item in items) | |
{%> | |
<option value="<%=HttpUtility.HtmlEncode(item.Value)%>" <%=item.Value == ViewData.Model.ToNullSafeString() ? " selected" : ""%>> | |
<%=Html.Encode(item.Text)%></option> |
This file contains hidden or 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 void Index_should_return_the_best_selling_products(){ | |
var products = new [new Product()]; | |
var fakeService = new Mock<IHomeControllerWorkerServices>() | |
.Setup(x=>x.GetBestSellingProductCategories()) | |
.Returns(products); | |
// regular work... | |
results.ShouldBeSameAs(products); | |
} | |
This file contains hidden or 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 FindPotentiallyMatchingExamsForCompletionSignOffQuery : Query<IEnumerable<ExamResult>> | |
{ | |
public override IEnumerable<ExamResult> Execute() | |
{ | |
ExamResult er = null; | |
Component c = null; | |
VibrationPoint vp = null; | |
ExamMethod m = null; | |
var matchingCodeSectionIds = QueryOver.Of(() => er) | |
.Where(() => er.Surveillance.Id == Surveillance) |
This file contains hidden or 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
require 'minitest/autorun' | |
class Employee | |
attr_reader :first_name, :last_name | |
def initialize(first_name, last_name) | |
@first_name = first_name | |
@last_name = last_name | |
end |