public void TestNamedAnnotationOnPropertyMarksDuplicate() { PropertyInfo property = FindProperty(typeof(Customer11), "NumberOfOrders"); PropertyInfo property1 = FindProperty(typeof(Customer11), "NumberOfOrders1"); var facetHolder1 = new FacetHolderImpl(); facetFactory.Process(property, methodRemover, facetHolder); facetFactory.Process(property1, methodRemover, facetHolder1); IFacet facet = facetHolder.GetFacet(typeof(INamedFacet)); Assert.IsNotNull(facet); Assert.IsTrue(facet is NamedFacetAbstract); var namedFacetAbstract = (NamedFacetAbstract)facet; Assert.AreEqual("some name", namedFacetAbstract.Value); AssertNoMethodsRemoved(); facet = facetHolder1.GetFacet(typeof(INamedFacet)); Assert.IsNotNull(facet); Assert.IsTrue(facet is NamedFacetAbstract); namedFacetAbstract = (NamedFacetAbstract)facet; Assert.AreEqual("some name", namedFacetAbstract.Value); AssertNoMethodsRemoved(); // Assert.Contains("Duplicate name: some name found on type: NakedObjects.Reflector.DotNet.Facets.Naming.Named.NamedAnnotationFacetFactoryTest+Customer11", NakedObjectsContext.InitialisationWarnings); }
public void ATestDisplayNameAnnotationOnActionIgnoresDuplicate() { // these need to run before logs are added by other tests MethodInfo actionMethod = FindMethod(typeof(Customer18), "SomeAction"); MethodInfo actionMethod1 = FindMethod(typeof(Customer18), "SomeAction1"); var facetHolder1 = new FacetHolderImpl(); facetFactory.Process(actionMethod, methodRemover, facetHolder); IFacet facet = facetHolder.GetFacet(typeof(INamedFacet)); Assert.IsNotNull(facet); Assert.IsTrue(facet is NamedFacetAbstract); var namedFacetAbstract = (NamedFacetAbstract)facet; Assert.AreEqual("some name", namedFacetAbstract.Value); AssertNoMethodsRemoved(); facetFactory.Process(actionMethod1, methodRemover, facetHolder1); facet = facetHolder.GetFacet(typeof(INamedFacet)); Assert.IsNotNull(facet); Assert.IsTrue(facet is NamedFacetAbstract); namedFacetAbstract = (NamedFacetAbstract)facet; Assert.AreEqual("some name", namedFacetAbstract.Value); AssertNoMethodsRemoved(); Assert.IsEmpty(NakedObjectsContext.InitialisationWarnings); }