public void GetDomainMethods_Sanity() { DomainServiceDescription description = DomainServiceDescription.GetDescription(typeof(DomainMethod_ValidProvider_MultipleMethods)); // verify that GetDomainMethods with City type only returns methods that are associated with City IEnumerable <DomainOperationEntry> domainMethods = description.GetCustomMethods(typeof(City)); Assert.IsNotNull(domainMethods); Assert.AreEqual(4, domainMethods.Count()); Assert.IsNotNull(domainMethods.Single(m => m.Name == "ProcessCity")); Assert.IsNotNull(domainMethods.Single(m => m.Name == "AssignCityZone")); Assert.IsNotNull(domainMethods.Single(m => m.Name == "AssignCityZoneIfAuthorized")); Assert.IsNotNull(domainMethods.Single(m => m.Name == "AutoAssignCityZone")); Assert.IsNull(domainMethods.FirstOrDefault(m => m.Name == "ProcessCounty")); // verify that GetDomainMethods with Zip type returns one method domainMethods = description.GetCustomMethods(typeof(Zip)); Assert.AreEqual(2, domainMethods.Count()); Assert.IsNotNull(domainMethods.Single(m => m.Name == "ReassignZipCode")); // verify that GetDomainMethods with County type returns one method domainMethods = description.GetCustomMethods(typeof(County)); Assert.AreEqual(1, domainMethods.Count()); Assert.IsNotNull(domainMethods.Single(m => m.Name == "ProcessCounty")); // verify that GetDomainMethods return empty collection when passing in type that is not associated with any methods on the provider domainMethods = description.GetCustomMethods(typeof(State)); Assert.IsNotNull(domainMethods); Assert.AreEqual(0, domainMethods.Count()); }
public void GetDomainMethods_NoDomainMethods() { DomainServiceDescription description = DomainServiceDescription.GetDescription(typeof(DomainMethod_ValidProvider_NoDomainMethods)); IEnumerable <DomainOperationEntry> domainMethods = description.GetCustomMethods(typeof(City)); Assert.IsNotNull(domainMethods); Assert.AreEqual(0, domainMethods.Count()); }
public void GetDomainmethods_NullEntityType() { DomainServiceDescription description = DomainServiceDescription.GetDescription(typeof(DomainMethod_ValidProvider_NoDomainMethods)); ExceptionHelper.ExpectArgumentNullException(delegate { description.GetCustomMethods(null); }, "entityType"); }