diff --git a/SportsStore/SportsStore.Domain/Abstract/IProductsRepository.cs b/SportsStore/SportsStore.Domain/Abstract/IProductRepository.cs similarity index 86% rename from SportsStore/SportsStore.Domain/Abstract/IProductsRepository.cs rename to SportsStore/SportsStore.Domain/Abstract/IProductRepository.cs index 88b9e8d..c5b2d56 100644 --- a/SportsStore/SportsStore.Domain/Abstract/IProductsRepository.cs +++ b/SportsStore/SportsStore.Domain/Abstract/IProductRepository.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace SportsStore.Domain.Abstract { - interface IProductsRepository + public interface IProductRepository { IQueryable Products { get; } } diff --git a/SportsStore/SportsStore.Domain/Entities/Product.cs b/SportsStore/SportsStore.Domain/Entities/Product.cs index 8890bfe..b069214 100644 --- a/SportsStore/SportsStore.Domain/Entities/Product.cs +++ b/SportsStore/SportsStore.Domain/Entities/Product.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace SportsStore.Domain.Entities { - class Product + public class Product { public int ProductID { get; set; } public string Name { get; set; } diff --git a/SportsStore/SportsStore.Domain/SportsStore.Domain.csproj b/SportsStore/SportsStore.Domain/SportsStore.Domain.csproj index 83a3426..2b6aef9 100644 --- a/SportsStore/SportsStore.Domain/SportsStore.Domain.csproj +++ b/SportsStore/SportsStore.Domain/SportsStore.Domain.csproj @@ -57,7 +57,9 @@ + + diff --git a/SportsStore/SportsStore.WebUI/Infrastructure/NinjectControllerFactory.cs b/SportsStore/SportsStore.WebUI/Infrastructure/NinjectControllerFactory.cs index 9a03ced..00d1589 100644 --- a/SportsStore/SportsStore.WebUI/Infrastructure/NinjectControllerFactory.cs +++ b/SportsStore/SportsStore.WebUI/Infrastructure/NinjectControllerFactory.cs @@ -1,10 +1,13 @@ -using Ninject; +using Moq; +using Ninject; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; +using SportsStore.Domain.Abstract; +using SportsStore.Domain.Entities; namespace SportsStore.WebUI.Infrastructure { @@ -26,7 +29,16 @@ namespace SportsStore.WebUI.Infrastructure private void AddBindings() { - // put additional bindings here + // Mock implementation of the IProductRepository Interface + Mock mock = new Mock(); + mock.Setup(m => m.Products).Returns(new List + { + new Product { Name = "Football", Price = 25 }, + new Product { Name = "Surf board", Price = 179 }, + new Product { Name = "Running shoes", Price = 95 } + }.AsQueryable()); + + ninjectKernel.Bind().ToConstant(mock.Object); } } } \ No newline at end of file diff --git a/SportsStore/SportsStore.WebUI/SportsStore.WebUI.csproj b/SportsStore/SportsStore.WebUI/SportsStore.WebUI.csproj index d50ea15..17c65d6 100644 --- a/SportsStore/SportsStore.WebUI/SportsStore.WebUI.csproj +++ b/SportsStore/SportsStore.WebUI/SportsStore.WebUI.csproj @@ -196,6 +196,12 @@ + + + {cfedebcd-de26-4a14-8cf2-95f735b1bb12} + SportsStore.Domain + + 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)