예제 #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);
        }