Example #1
0
        public async Task ValidateFinds_Ok()
        {
            var testEntities = TestEntitiesData.TestEntities;
            var ids          = testEntities.Select(testEntity => testEntity.Id);
            var testIncludeValidateService = TestIncludeValidateServiceMock.GetTestIncludeValidateService();
            var dbSetTest           = TestDatabaseSetMock.GetDbSetTest(testEntities);
            var testTable           = new TestTable(dbSetTest.Object);
            var testValidateService = new TestDatabaseValidateService(testTable, testIncludeValidateService.Object);

            var result = await testValidateService.ValidateFinds(ids);

            Assert.True(result.OkStatus);
        }
Example #2
0
        public async Task ValidateFinds_NotFound()
        {
            var testEntities = Enumerable.Empty <TestEntity>().ToList();
            var ids          = TestEntitiesData.TestEntities.Select(testEntity => testEntity.Id);
            var testIncludeValidateService = TestIncludeValidateServiceMock.GetTestIncludeValidateService();
            var dbSetTest           = TestDatabaseSetMock.GetDbSetTest(testEntities);
            var testTable           = new TestTable(dbSetTest.Object);
            var testValidateService = new TestDatabaseValidateService(testTable, testIncludeValidateService.Object);

            var result = await testValidateService.ValidateFinds(ids);

            Assert.True(result.HasErrors);
            Assert.True(result.Errors.First().ErrorResultType == ErrorResultType.ValueNotFound);
        }