Feature/respect encapsulation (#349)

* resolve osbsolete method

* put all properties as private, align unit test

* fix version of version in MD, add instruction to install ef tool

* fix url stored
This commit is contained in:
Cédric Michel
2020-02-03 20:47:59 +01:00
committed by GitHub
parent 288d827821
commit 3e228035c0
22 changed files with 162 additions and 99 deletions

View File

@@ -3,12 +3,14 @@ using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Moq;
namespace Microsoft.eShopWeb.UnitTests
{
public class BasketWithItems
{
private int _testBasketId = 123;
private readonly int _testBasketId = 123;
private readonly string _buyerId = "Test buyerId";
[Fact]
public void MatchesBasketWithGivenId()
@@ -37,11 +39,18 @@ namespace Microsoft.eShopWeb.UnitTests
public List<Basket> GetTestBasketCollection()
{
var basket1Mock = new Mock<Basket>(_buyerId);
basket1Mock.SetupGet(s => s.Id).Returns(1);
var basket2Mock = new Mock<Basket>(_buyerId);
basket2Mock.SetupGet(s => s.Id).Returns(2);
var basket3Mock = new Mock<Basket>(_buyerId);
basket3Mock.SetupGet(s => s.Id).Returns(_testBasketId);
return new List<Basket>()
{
new Basket() { Id = 1 },
new Basket() { Id = 2 },
new Basket() { Id = _testBasketId }
basket1Mock.Object,
basket2Mock.Object,
basket3Mock.Object
};
}
}

View File

@@ -3,6 +3,7 @@ using Microsoft.eShopWeb.ApplicationCore.Entities;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Moq;
namespace Microsoft.eShopWeb.UnitTests
{
@@ -31,11 +32,11 @@ namespace Microsoft.eShopWeb.UnitTests
{
return new List<CatalogItem>()
{
new CatalogItem() { Id = 1, CatalogBrandId = 1, CatalogTypeId= 1 },
new CatalogItem() { Id = 2, CatalogBrandId = 1, CatalogTypeId= 2 },
new CatalogItem() { Id = 3, CatalogBrandId = 1, CatalogTypeId= 3 },
new CatalogItem() { Id = 4, CatalogBrandId = 2, CatalogTypeId= 1 },
new CatalogItem() { Id = 5, CatalogBrandId = 2, CatalogTypeId= 2 },
new CatalogItem(1, 1, "Description", "Name", 0, "FakePath"),
new CatalogItem(2, 1, "Description", "Name", 0, "FakePath"),
new CatalogItem(3, 1, "Description", "Name", 0, "FakePath"),
new CatalogItem(1, 2, "Description", "Name", 0, "FakePath"),
new CatalogItem(2, 2, "Description", "Name", 0, "FakePath"),
};
}
}