Exemplo n.º 1
0
        public async Task AllExcludedFieldsAreVoidedAsync_ReqDefHasNoFields_ShouldReturnTrue()
        {
            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var dut    = new RequirementDefinitionValidator(context);
                var result = await dut.AllExcludedFieldsAreVoidedAsync(_reqDefWithoutField.Id, new List <int>(), default);

                Assert.IsTrue(result);
            }
        }
Exemplo n.º 2
0
        public async Task AllExcludedFieldsAreVoidedAsync_TheExcludedFieldIsNotVoided_ShouldReturnFalse()
        {
            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var dut    = new RequirementDefinitionValidator(context);
                var result = await dut.AllExcludedFieldsAreVoidedAsync(_reqDefWithTwoFields.Id, new List <int> {
                    _numberFieldId
                }, default);

                Assert.IsFalse(result);
            }
        }
Exemplo n.º 3
0
        public async Task AllExcludedFieldsAreVoidedAsync_AllExcludedFieldAreVoided_ShouldReturnTrue()
        {
            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var cbField = context.Fields.Single(f => f.Id == _cbFieldId);
                cbField.IsVoided = true;
                var numberField = context.Fields.Single(f => f.Id == _numberFieldId);
                numberField.IsVoided = true;
                context.SaveChangesAsync().Wait();
            }

            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var dut    = new RequirementDefinitionValidator(context);
                var result = await dut.AllExcludedFieldsAreVoidedAsync(_reqDefWithTwoFields.Id, new List <int>(), default);

                Assert.IsTrue(result);
            }
        }