Ejemplo n.º 1
0
        public void GetRnd_ArgAreIncostistent_ReturnsNull(
            BaseFunnyType returnType, BaseFunnyType firstArg, BaseFunnyType secondArg)
        {
            var rpt      = new GetRandomElementFuncDefinition();
            var function = rpt.CreateConcreteOrNull(
                FunnyType.PrimitiveOf(returnType),
                FunnyType.PrimitiveOf(firstArg),
                FunnyType.PrimitiveOf(secondArg));

            Assert.IsNull(function);
        }
Ejemplo n.º 2
0
        public void GetRnd_RealInt_Real_GenericEqualsReal()
        {
            var rpt      = new GetRandomElementFuncDefinition();
            var function = rpt.CreateConcreteOrNull(
                FunnyType.Real,
                FunnyType.Int32,
                FunnyType.Int32);

            Assert.IsNotNull(function);
            Assert.Multiple(() =>
            {
                Assert.AreEqual(FunnyType.Real, function.ReturnType);
                CollectionAssert.AreEquivalent(new[] { FunnyType.Real, FunnyType.Real }, function.ArgTypes);
            });
        }
Ejemplo n.º 3
0
        public void GetRnd_GenericEqualsOutputType(
            BaseFunnyType returnType, BaseFunnyType firstArg, BaseFunnyType secondArg)
        {
            var rpt      = new GetRandomElementFuncDefinition();
            var function = rpt.CreateConcreteOrNull(
                FunnyType.PrimitiveOf(returnType),
                FunnyType.PrimitiveOf(firstArg),
                FunnyType.PrimitiveOf(secondArg));
            var generic = FunnyType.PrimitiveOf(returnType);

            Assert.IsNotNull(function);
            Assert.Multiple(() =>
            {
                Assert.AreEqual(generic, function.ReturnType);
                CollectionAssert.AreEquivalent(new[] { generic, generic }, function.ArgTypes);
            });
        }