//Fake DataBase private List <PartSummary> Context() { var list = new List <PartSummary>(); list.Add(new PartSummary { Description = "Description 1", PartNumber = PartNumber.For("1234-1234abcd") }); list.Add(new PartSummary { Description = "Description 2", PartNumber = PartNumber.For("1235-abcd") }); list.Add(new PartSummary { Description = "Description 3", PartNumber = PartNumber.For("1236-efgh") }); list.Add(new PartSummary { Description = "Description 4", PartNumber = PartNumber.For("1237-1233") } ); return(list); }
public void ToStringReturnsCorrectFormat() { const string value = "1234-1234abcd"; var partNumber = PartNumber.For(value); Assert.AreEqual(value, partNumber.ToString()); }
public void ImplicitConversionToStringResultsInCorrectString() { const string value = "1234-1234abcd"; var partNumber = PartNumber.For(value); string result = partNumber; Assert.AreEqual(value, result); }
public void ShouldHaveCorrectPartIdAndPartCode() { string value = "1234-1234abcd"; var partNumber = PartNumber.For(value); string result = partNumber; Assert.AreEqual(value, result); }
public IEnumerable <PartSummary> GetCompatibleParts(string partNumber) { var list = new List <PartSummary>(); PartNumber part = PartNumber.For(partNumber); //No to send to PartsTrader => return a empty list if (CheckExclusionList(partNumber)) { return(list); } //Allow to go to PartsTrader return(_service.FindAllCompatibleParts(partNumber)); }
//Fake Database protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity <PartSummary>().HasData(new PartSummary { Description = "Description 1", PartNumber = PartNumber.For("1234-1234abcd") }, new PartSummary { Description = "Description 2", PartNumber = PartNumber.For("1235-abcd") }, new PartSummary { Description = "Description 3", PartNumber = PartNumber.For("1236-efgh") } , new PartSummary { Description = "Description 4", PartNumber = PartNumber.For("1237-1233") }); }
public void ShouldHaveWrongWithoutDash() { var partNumber = PartNumber.For("a234abcd"); }
public void ShouldHaveWrongPartIdWithCharacters() { var partNumber = PartNumber.For("a234-abcd"); }
public void ShouldHaveWrongPartCodeLessThan4() { var partNumber = PartNumber.For("1234-a23"); }
public void ShouldHaveWrongPartIdLessThan4() { var partNumber = PartNumber.For("123-abcd"); }