Ejemplo n.º 1
0
        public void UnionGeneratesCorrectType()
        {
            TSParameter firstParameter  = new TSParameter("Name", "Type", "description");
            TSParameter secondParameter = new TSParameter("Name", "OtherType", "description");
            TSParameter thirdParameter  = new TSParameter("Name", "Type", "description");

            TSParameter union = TSParameter.Union(firstParameter, secondParameter, thirdParameter);

            Assert.AreEqual("Type | OtherType", union.Type);
        }
Ejemplo n.º 2
0
        public void UnionGeneratesCorrectDescription()
        {
            TSParameter firstParameter  = new TSParameter("Name", "Type", "The description");
            TSParameter secondParameter = new TSParameter("Name", "Type", "Some other Description");
            TSParameter thirdParameter  = new TSParameter("Name", "Type", "Third description");

            TSParameter union = TSParameter.Union(firstParameter, secondParameter, thirdParameter);

            Assert.AreEqual("The description or some other Description or third description", union.Description);
        }
Ejemplo n.º 3
0
        public void UnionGeneratesCorrectName()
        {
            TSParameter firstParameter  = new TSParameter("Name", "Type", "description");
            TSParameter secondParameter = new TSParameter("otherName", "Type", "description");
            TSParameter thirdParameter  = new TSParameter("moreComplicatedName", "Type", "description");

            TSParameter union = TSParameter.Union(firstParameter, secondParameter, thirdParameter);

            Assert.AreEqual("nameOrOtherNameOrMoreComplicatedName", union.Name);
        }
Ejemplo n.º 4
0
 public static TSParameter Union(params TSParameter[] parameters)
 {
     return(TSParameter.Union(parameters, null, null, null, null));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Add a parameter to this parameter list.
 /// </summary>
 /// <param name="parameter">The parameter to add.</param>
 public void Parameter(TSParameter parameter)
 {
     Parameter(parameter.Name, parameter.Type, !parameter.Required);
 }
Ejemplo n.º 6
0
 public void UnionThrowsIfOneElementPassed()
 {
     Assert.ThrowsException <ArgumentException>(() => TSParameter.Union(new TSParameter("name", "type", "description")));
 }
Ejemplo n.º 7
0
 public void UnionThrowsIfNoElementsPassed()
 {
     Assert.ThrowsException <ArgumentException>(() => TSParameter.Union(new TSParameter[] { }));
 }
Ejemplo n.º 8
0
        public void ConstructorShouldUnionizeTypesProperly()
        {
            TSParameter parameter = new TSParameter("parameterName", new[] { "MyType", "AnotherType", "OneMoreType" }, "description");

            Assert.AreEqual("MyType | AnotherType | OneMoreType", parameter.Type);
        }
Ejemplo n.º 9
0
        public void ConstructorShouldSetSingleTypeProperly()
        {
            TSParameter parameter = new TSParameter("parameterName", new[] { "MyType" }, "description");

            Assert.AreEqual("MyType", parameter.Type);
        }