Пример #1
0
        public void TestAll()
        {
            var test = ModelBinderBuilder <Movie> .Get()
                       .All()
                       .ToString();

            Assert.AreEqual("Id,Name,Genre,GenreId,DateAdded,ReleaseDate,NumberInStock,NumberAvailable", test);
        }
Пример #2
0
        public void TestAddMultipleProperties()
        {
            var test = ModelBinderBuilder <Movie> .Get()
                       .Add(x => x.NumberAvailable)
                       .Add(x => x.GenreId)
                       .Add(x => x.Name)
                       .Add(x => x.Id)
                       .Add(x => x.NumberAvailable)
                       .ToString();

            Assert.AreEqual("NumberAvailable,GenreId,Name,Id", test);
        }
Пример #3
0
        public void TestCannotAddPropertyFromOtherType()
        {
            var g = new Genre();

            Action p = () =>
            {
                ModelBinderBuilder <Movie> .Get()
                .Add(x => x.NumberAvailable)
                .Add(x => g.GenreName);
            };

            Assert.ThrowsException <ArgumentException>(p);
        }
Пример #4
0
        public void TestGetPropertyName()
        {
            string test = ModelBinderBuilder <Movie> .Get().GetProperty(x => x.Name);

            Assert.AreEqual("Name", test);
        }