public void AddOperationWhileTypeHasSameName() { EdmModel model = new EdmModel(); EdmComplexType c1 = new EdmComplexType("Ambiguous", "Binding"); IEdmOperation o1 = new EdmFunction("Ambiguous", "Binding", EdmCoreModel.Instance.GetInt16(true)); IEdmOperation o2 = new EdmFunction("Ambiguous", "Binding", EdmCoreModel.Instance.GetInt16(true)); IEdmOperation o3 = new EdmFunction("Ambiguous", "Binding", EdmCoreModel.Instance.GetInt16(true)); model.AddElement(o1); Assert.AreEqual(1, model.FindOperations("Ambiguous.Binding").Count(), "First function was correctly added to operation group"); model.AddElement(o2); Assert.AreEqual(2, model.FindOperations("Ambiguous.Binding").Count(), "Second function was correctly added to operation group"); model.AddElement(c1); model.AddElement(o3); Assert.AreEqual(3, model.FindOperations("Ambiguous.Binding").Count(), "Third function was correctly added to operation group"); Assert.AreEqual(c1, model.FindType("Ambiguous.Binding"), "Single item resolved"); }
public void AddCustomElementToAmodel() { // Negative test try { (new EdmModel()).AddElement(new AnEdmElement()); } catch (InvalidCastException e) { Assert.IsTrue(e is InvalidCastException, "It should fail when casting to IEdmFuncition."); } // Positive test var edmModel = new EdmModel(); edmModel.AddElement(new AnEdmOperationElement()); Assert.IsTrue(edmModel.FindOperations("MyNamespace.MyName").Any(), "Faild to find the newly added element."); }