public void TestAll() { var test = ModelBinderBuilder <Movie> .Get() .All() .ToString(); Assert.AreEqual("Id,Name,Genre,GenreId,DateAdded,ReleaseDate,NumberInStock,NumberAvailable", test); }
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); }
public void TestCannotAddPropertyFromOtherType() { var g = new Genre(); Action p = () => { ModelBinderBuilder <Movie> .Get() .Add(x => x.NumberAvailable) .Add(x => g.GenreName); }; Assert.ThrowsException <ArgumentException>(p); }
public void TestGetPropertyName() { string test = ModelBinderBuilder <Movie> .Get().GetProperty(x => x.Name); Assert.AreEqual("Name", test); }