Example #1
0
        public void assure_its_added()
        {
            var viewModelData = new ViewModelProperty("Username", typeof(string).Name, false);

            When("adding ViewModelData", () =>
                viewModel.AddProperty(viewModelData));

            Then(() =>
                 viewModel.Properties.ShouldContain(viewModelData));
        }
Example #2
0
        public void AddProperty(ViewModelProperty data)
        {
            ThrowExceptionIfNull(data, "data");

            _data.Add(data);
        }
Example #3
0
        private void ParseViewModelProperties()
        {
            var attributes = new List<string>();
            while (CurrentToken().Kind == Kind.attribute)
            {
                attributes.Add(CurrentToken().Value);
                NextToken();
            }

            var propertyToken = CurrentToken();
            var nameToken = NextToken();
            var asToken = NextToken();
            var typeToken = NextToken();

            if (nameToken.Kind != Kind.Name)
                throw new InvalidSyntaxException("Name must be specified when using the 'property' keyword");

            if (asToken.Kind != Kind.AS ||
                typeToken.Kind != Kind.Name)
                throw new InvalidSyntaxException("Type must be specified when using the 'property' keyword");

            //Name
            var name = nameToken.Value;

            //Type
            var type = typeToken.Value;

            //IsObservable
            var isObservable = (propertyToken == Token.OProperty) ? true : false;

            var viewModelProperty = new ViewModelProperty(name, type, isObservable);
            viewModelProperty.Attributes.AddRange(attributes);

            semanticModel.AddProperty(viewModelProperty);
        }
Example #4
0
        public void AddProperty(ViewModelProperty data)
        {
            ThrowExceptionIfNull(data, "data");

            _data.Add(data);
        }