コード例 #1
0
        public void DsfMethodBasedActivity_Inputs_NotNull_Name_Null_ExpectListsCountNonZero()
        {
            //-------------------Arrange------------------------
            var itrs = new List <IWarewolfIterator>(5);
            var mockDSFDataObject = new Mock <IDSFDataObject>();

            var testDsfMethodBasedActivity = new TestDsfMethodBasedActivity();
            var inputList     = new List <MethodParameter>();
            var environment   = new ExecutionEnvironment();
            var dataListID    = Guid.NewGuid();
            var itrCollection = new WarewolfListIterator();

            mockDSFDataObject.Setup(o => o.DataListID).Returns(dataListID);
            mockDSFDataObject.Setup(o => o.Environment).Returns(environment);

            var methodParamList = new MethodParameter {
                EmptyToNull = false, IsRequired = false, Name = null, Value = "TestValue", TypeName = "TestTypeName"
            };

            inputList.Add(methodParamList);

            var methodParameters = inputList?.Select(a => new MethodParameter {
                EmptyToNull = a.EmptyToNull, IsRequired = a.IsRequired, Name = a.Name, Value = a.Value, TypeName = a.TypeName
            }).ToList() ?? new List <MethodParameter>();

            //-------------------Act----------------------------
            testDsfMethodBasedActivity.TestBuildParameterIterators(0, methodParameters, itrCollection, itrs, mockDSFDataObject.Object);
            //-------------------Assert-------------------------
            Assert.AreEqual(1, itrs.Count);
            Assert.AreEqual(1, itrCollection.FieldCount);
            Assert.AreEqual(dataListID, mockDSFDataObject.Object.DataListID);
        }
コード例 #2
0
        public void DsfMethodBasedActivity_Inputs_Null_ExpectZeroListsCount()
        {
            //-------------------Arrange------------------------
            var itrCollection              = new WarewolfListIterator();
            var itrs                       = new List <IWarewolfIterator>(5);
            var dSFDataObject              = new DsfDataObject("", Guid.NewGuid());
            var methodParameters           = new List <MethodParameter>();
            var testDsfMethodBasedActivity = new TestDsfMethodBasedActivity();

            var mockServiceInput           = new Mock <IServiceInput>();
            var mockServiceInputCollection = new Mock <ICollection <IServiceInput> >();

            mockServiceInputCollection.Setup(o => o.Add(mockServiceInput.Object));
            //-------------------Act----------------------------
            testDsfMethodBasedActivity.TestBuildParameterIterators(0, methodParameters.ToList(), itrCollection, itrs, dSFDataObject);
            //-------------------Assert-------------------------
            Assert.AreEqual(0, itrs.Count);
            Assert.AreEqual(0, itrCollection.FieldCount);
        }