Esempio n. 1
0
        public async Task Validator_CaseInsensitiveColumnNameComparison_ReturnNoErrors()
        {
            // Arrange
            using var context = new ContextWithMixedCaseColumns(_connectionString);
            var caseInsensitiveValidator = new DbContextValidator(StringComparer.InvariantCultureIgnoreCase);

            // Act
            var errors = await caseInsensitiveValidator.ValidateContextAsync(context);

            // Assert
            errors.Should().BeEmpty();
        }
Esempio n. 2
0
        public async Task Validator_ValidContext_ReturnNoErrors()
        {
            // Arrange
            using var context = new ValidContext(_connectionString);

            // Act
            var errors = await _defaultValidator.ValidateContextAsync(context);

            // Assert
            errors.Should().BeEmpty();
            // ReSharper disable AccessToDisposedClosure
            Func <Task> customersTask = async() => { await context.Customers.ToListAsync(); };
            Func <Task> ordersTask    = async() => { await context.Orders.ToListAsync(); };
            // ReSharper restore AccessToDisposedClosure
            await customersTask.Should().NotThrowAsync();

            await ordersTask.Should().NotThrowAsync();
        }