public decimal GetStok(string brgID) { decimal result = 0; var listStok = _stokInDal.ListData(brgID); if (listStok != null) { result = listStok.Sum(x => x.QtySaldo); } return(result); }
public void ListDataTest() { using (var trans = TransHelper.NewScope()) { // arrange var item1 = StokInDataFactory(); _stokInDal.Insert(item1); var item2 = StokInDataFactory2(); _stokInDal.Insert(item2); var expected = new List <StokInModel> { item1, item2 }; // act var actual = _stokInDal.ListData("B1"); // assert actual.Should().BeEquivalentTo(expected, config => config .Excluding(x => x.BrgName)); } }