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
| class Identity | |
| attr_reader :value | |
| def initialize( value ) | |
| @value = value | |
| end | |
| def bind | |
| yield @value | |
| end |
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
| class Maybe | |
| attr_reader :value | |
| def initialize ( value ) | |
| @value = value | |
| end | |
| def bind | |
| if (@value == nil) | |
| Maybe.new( nil ) |
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 "../list" | |
| require "spec" | |
| describe "Create a FuncList" do | |
| # Called before each example. | |
| before(:each) do | |
| @subject = FuncList.new | |
| end |
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
| namespace Cloud.ATS.Domain.Tests | |
| { | |
| using Entities; | |
| using NBehave.Narrator.Framework; | |
| using Xunit; | |
| using Xunit.AssertExtensions; | |
| using Xunit.Specifications; |
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 interface IDetailLoader<T> | |
| { | |
| void Load(string importPath, Action<T> addToBatch); | |
| IEnumerable<T> GetDetailItems(IEnumerable<Row> rows); | |
| T GetDetailItemFrom(Row row) | |
| } |
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 abstract class DetailLoader<T> : IDetailLoader<T> | |
| { | |
| public virtual void Load(string importPath, ProgressItem progressItem, Action<T> addToBatch) | |
| { | |
| var spreadsheet = SpreadsheetDocument.Load(importPath); | |
| var rows = spreadsheet.Rows(); | |
| progressItem.Start(rows.Count()); | |
| var details = GetDetailItems(rows, progressItem); |
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 DetailLoaderWithProgressItem<T> : IDetailLoader<T> | |
| { | |
| private IDetailLoader<T> _loader; | |
| private ProgressItem _progressItem; | |
| public DetailLoaderWithProgressItem(IDetailLoader<T> loader, ProgressItem progressItem) | |
| { | |
| _loader = loader; | |
| _progressItem = progressItem; | |
| } |
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 abstract class DetailLoader<T> : IDetailLoader<T> | |
| { | |
| public virtual void Load(string importPath, Action<T> addToBatch) | |
| { | |
| var spreadsheet = SpreadsheetDocument.Load(importPath); | |
| var rows = spreadsheet.Rows(); | |
| var details = GetDetailItems(rows); | |
| foreach (var detail in details) | |
| addToBatch(detail); |
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
| namespace Foundation.Specifications | |
| { | |
| /// <summary> | |
| /// Interface for a specification. | |
| /// </summary> | |
| /// <typeparam name="T">The type specified.</typeparam> | |
| /// <seealso href="http://www.lostechies.com/blogs/chrismissal/archive/2009/09/10/using-the-specification-pattern-for-querying.aspx" /> | |
| public interface ISpecification<T> | |
| { | |
| /// <summary> |
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 System; | |
| using System.Linq.Expressions; | |
| namespace Foundation.Specifications | |
| { | |
| /// <summary> | |
| /// A composite specification. | |
| /// </summary> | |
| /// <seealso href="http://www.lostechies.com/blogs/chrismissal/archive/2009/09/10/using-the-specification-pattern-for-querying.aspx" /> | |
| public static class CompositeSpecification |
OlderNewer