示例#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);
        }
示例#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);
            });
        }
示例#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);
            });
        }