public BehaviorElement CreateBehavior(IDeclaredElement field)
        {
            var clazz = ((ITypeMember)field).GetContainingType() as IClass;

            if (clazz == null)
            {
                return(null);
            }

            var context = _cache.TryGetContext(clazz);

            if (context == null)
            {
                return(null);
            }

            var fieldType = new NormalizedTypeName(field as ITypeOwner);

            var behavior = GetOrCreateBehavior(context,
                                               clazz.GetClrName(),
                                               field.ShortName,
                                               field.IsIgnored(),
                                               fieldType);

            foreach (var child in behavior.Children)
            {
                child.State = UnitTestElementState.Pending;
            }

            _cache.AddBehavior(field, behavior);
            return(behavior);
        }
        public void UpdateChildState(ITypeElement type)
        {
            var context = _cache.TryGetContext(type);

            if (context == null)
            {
                return;
            }

            foreach (var element in context
                     .Children.Where(x => x.State == UnitTestElementState.Pending)
                     .Flatten(x => x.Children))
            {
                element.State = UnitTestElementState.Invalid;
            }
        }
Exemple #3
0
        public ContextSpecificationElement CreateContextSpecification(IDeclaredElement field)
        {
            var clazz = ((ITypeMember)field).GetContainingType() as IClass;

            if (clazz == null)
            {
                return(null);
            }

            var context = _cache.TryGetContext(clazz);

            if (context == null)
            {
                return(null);
            }

            return(GetOrCreateContextSpecification(context,
                                                   clazz.GetClrName().GetPersistent(),
                                                   field.ShortName,
                                                   field.IsIgnored()));
        }