예제 #1
0
        public void CachingWorksCorrectly()
        {
            var repository = new QueryRepository();
            var count      = repository.Get().Count();
            var isbns      = new[] { "9788741201122" };
            var command    = new UpdateCommand(isbns);

            (new UpdateCommandHandler(new FakeProductApi(), new UnitOfWork())).Execute(command);
            repository.Get().Count().Should().Be(count + 1);
        }
예제 #2
0
        protected async override Task <ActionResult> DeleteEntity(EmployeeEntity entity)
        {
            if (entity.Staff?.Count > 0)
            {
                return(BadRequest(BadRequestReasonExtended.ManagerHasStaff));
            }
            if (!string.IsNullOrEmpty(entity.Manager))
            {
                var manger = await QueryRepository.Get(entity.Manager);

                manger.Staff.Remove(entity.Id);
                await AlterRepository.Update(manger);
            }
            return(await base.DeleteEntity(entity));
        }
예제 #3
0
        public void GetQuery()
        {
            // Arrange
            int      ElementsCountBeforeAct = queriesDbSet.Count();
            SqlQuery expectedQuery          = queriesDbSet.First();

            // Act
            SqlQuery query = queryRepo.Get(0);

            // Assert
            Assert.AreEqual(expectedQuery, query);
            Assert.AreEqual(expectedQuery.SqlQueryName, query.SqlQueryName);
            Assert.AreEqual(expectedQuery.SqlQueryId, query.SqlQueryId);
            Assert.AreNotEqual(query, queriesDbSet.Last());
            Assert.IsTrue(queriesDbSet.Count() == ElementsCountBeforeAct);
        }