using System; using System.Collections.Generic; using System.Linq; using System.Text; using NUnit.Framework; using Developpez.Dotnet.Linq; namespace Developpez.Dotnet.Tests.Linq { [TestFixture] public class LinqHelperTests { #region Dummy properties and methods public int Foo { get; set; } public int Bar(int x) { return x; } public void Baz(int x) { } #endregion [Test] public void Test_GetPropertyName() { string expected = "Foo"; string actual = LinqHelper.GetPropertyName(() => Foo); Assert.AreEqual(actual, expected); Assert2.Throws( () => actual = LinqHelper.GetPropertyName(() => Bar(42))); } [Test] public void Test_GetMethodName() { string expected = "Bar"; string actual = LinqHelper.GetMethodName(() => Bar(42)); Assert.AreEqual(actual, expected); expected = "Baz"; actual = LinqHelper.GetMethodName(() => Baz(42)); Assert.AreEqual(actual, expected); Assert2.Throws( () => actual = LinqHelper.GetMethodName(() => Foo)); } } }