view SilverlightExampleApp/SilverlightExampleApp.Web/Factories/TitleFactory.cs @ 96:188f8b366e87

Unit test project correctly setup as normal class library DLL.
author stevenhollidge <stevenhollidge@hotmail.com>
date Sat, 05 May 2012 13:29:56 +0100
parents 502f5f365649
children
line wrap: on
line source

using System.Collections.Generic;
using System.Linq;
using SilverlightExampleApp.Interfaces.Models;
using SilverlightExampleApp.Web.Models;

namespace SilverlightExampleApp.Web.Factories
{
    public class TitleFactory
    {
        private readonly static IList<ITitle> _titles = new List<ITitle>(7)
                                        {
                                            new Title() {Id = 1, Description = "Mr"},
                                            new Title() {Id = 2, Description = "Miss"},
                                            new Title() {Id = 3, Description = "Mrs"},
                                            new Title() {Id = 4, Description = "Ms"},
                                            new Title() {Id = 5, Description = "Master"},
                                            new Title() {Id = 6, Description = "Sir"},
                                            new Title() {Id = 7, Description = "Dr"}
                                        };
        public static IList<ITitle> GetAll()
        {
            return _titles;
        }

        public static ITitle Get(int id)
        {
            return _titles.FirstOrDefault(t => id == t.Id);
        }
    }
}