Ejemplo n.º 1
0
        public void GetAnyButNoneExistTest()
        {
            //Given
            var databseFactory =
                new DatabaseFactoryBase <SharedCommonDatabaseContext>("SharedCommonDatabaseContext");

            var repository = new AccountRepository(databseFactory);

            //When
            var hasAny = repository.Any(x => false);

            //Then
            Assert.IsFalse(hasAny, "No items should have been found.");
        }
Ejemplo n.º 2
0
        public void GetAnySuccessTest()
        {
            //Given
            var databseFactory =
                new DatabaseFactoryBase <SharedCommonDatabaseContext>("SharedCommonDatabaseContext");

            using (var unitOfWork = new UnitOfWork <SharedCommonDatabaseContext>(databseFactory))
            {
                var repository  = new AccountRepository(databseFactory);
                var listOfItems = AccountEntityHelper.CreateTestAccounts(3);
                listOfItems[2].CompanyName = "TestReferenceOtherValue";
                repository.AddRange(listOfItems);
                unitOfWork.Commit();

                //When
                var hasAny = repository.Any(x => x.CompanyName.Contains("TestReference"));

                //Then
                Assert.IsTrue(hasAny, "None were found when there should have been some.");
            }
        }