Esempio n. 1
0
        public void GetBillsReturnsListOfBills()
        {
            var data               = SetupExpectedBillDataModels();
            var dbSetMock          = SetupMockDbSet(data);
            var dbContextMock      = SetupMockDbContext(dbSetMock);
            var stubDataRepository = new StubDataRepository(dbContextMock.Object);
            var rssClientMock      = new Mock <IRssClient>();
            var billsService       = new BillsService(stubDataRepository, rssClientMock.Object);

            List <BillViewModel> result = billsService.GetAllBills();

            Assert.IsTrue(result.Count == 2);
        }
Esempio n. 2
0
        public void UpdateBillDataPopulatesDatabaseWhenEmpty()
        {
            var data               = new List <BillDataModel>().AsQueryable();
            var dbSetMock          = SetupMockDbSet(data);
            var dbContextMock      = SetupMockDbContext(dbSetMock);
            var stubDataRepository = new StubDataRepository(dbContextMock.Object);
            var rssClientMock      = new Mock <IRssClient>();

            rssClientMock.Setup(x => x.GetBills(It.IsAny <string>())).Returns(SetupExpectedBillDataModels().ToList);

            var billsService = new BillsService(stubDataRepository, rssClientMock.Object);

            //billsService.UpdateBillData();
            dbContextMock.Verify(x => x.Set <BillDataModel>());
        }