public void RedisCacheActivityFindMissingStrategy_GetActivityFields_CheckRedisCacheActivityWithDsfMultiAssignActivity_ExpectedAllFindMissingFieldsToBeReturned()
        {
            //--------------Arrange------------------------------
            var multiAssignActivity = new DsfMultiAssignActivity {
                FieldsCollection = new List <ActivityDTO> {
                    new ActivityDTO("[[AssignRight1]]", "[[AssignLeft1]]", 1), new ActivityDTO("[[AssignRight2]]", "[[AssignLeft2]]", 2)
                }
            };
            var activity = new RedisCacheActivity
            {
                DisplayName  = "Redis Cache",
                ActivityFunc = { Handler = multiAssignActivity }
            };
            var findMissingStrategyFactory = new Dev2FindMissingStrategyFactory();
            var strategy = findMissingStrategyFactory.CreateFindMissingStrategy(enFindMissingType.RedisCache);

            //--------------Act----------------------------------
            var actual = strategy.GetActivityFields(activity);

            //--------------Assert-------------------------------
            var expected = new List <string> {
                "[[AssignRight1]]", "[[AssignLeft1]]", "[[AssignRight2]]", "[[AssignLeft2]]", "5"
            };

            CollectionAssert.AreEqual(expected, actual);
        }
        public void RedisCacheActivityFindMissingStrategy_GetActivityFields_CheckRedisCacheActivityWithDsfActivity_ExpectedAllFindMissingFieldsToBeReturned()
        {
            //--------------Arrange------------------------------
            var dsfActivity = new DsfActivity
            {
                InputMapping  = @"<Inputs><Input Name=""reg"" Source=""NUD2347"" DefaultValue=""NUD2347""><Validator Type=""Required"" /></Input><Input Name=""asdfsad"" Source=""registration223"" DefaultValue=""w3rt24324""><Validator Type=""Required"" /></Input><Input Name=""number"" Source=""[[number]]"" /></Inputs>",
                OutputMapping = @"<Outputs><Output Name=""vehicleVin"" MapsTo=""VIN"" Value="""" /><Output Name=""vehicleColor"" MapsTo=""VehicleColor"" Value="""" /><Output Name=""speed"" MapsTo=""speed"" Value="""" Recordset=""Fines"" /><Output Name=""date"" MapsTo=""date"" Value=""Fines.Date"" Recordset=""Fines"" /><Output Name=""location"" MapsTo=""location"" Value="""" Recordset=""Fines"" /></Outputs>"
            };
            var activity = new RedisCacheActivity
            {
                DisplayName  = "Redis Cache",
                ActivityFunc = { Handler = dsfActivity }
            };
            var findMissingStrategyFactory = new Dev2FindMissingStrategyFactory();
            var strategy = findMissingStrategyFactory.CreateFindMissingStrategy(enFindMissingType.RedisCache);

            //--------------Act----------------------------------
            var actual = strategy.GetActivityFields(activity);

            //--------------Assert-------------------------------
            var expected = new List <string> {
                "NUD2347", "registration223", "[[number]]", "Fines.Date", "5"
            };

            CollectionAssert.AreEqual(expected, actual);
        }
        static ModelItem CreateModelItem(string key, int ttl)
        {
            var innerActivity = new DsfMultiAssignActivity()
            {
                FieldsCollection = new List <ActivityDTO> {
                    new ActivityDTO("[[objectId1]]", "ObjectName1", 1), new ActivityDTO("[[objectId2]]", "ObjectName2", 2)
                }
            };

            var redisCacheActivity = new RedisCacheActivity
            {
                Key          = key,
                TTL          = ttl,
                ActivityFunc = new ActivityFunc <string, bool>
                {
                    Handler = innerActivity
                }
            };

            return(ModelItemUtils.CreateModelItem(redisCacheActivity));
        }
Beispiel #4
0
        public void RedisRemoveActivity_Equals_GetType_AreNotEqual()
        {
            var mockResourceCatalog = new Mock <IResourceCatalog>();
            //---------------Set up test pack-------------------
            var uniqId = Guid.NewGuid();
            var redisRemoveActivity = new RedisRemoveActivity(mockResourceCatalog.Object, null)
            {
                SourceId    = uniqId,
                Result      = "A",
                Key         = "[[Key]]",
                DisplayName = "Redis Remove",
                Response    = "asdf",
            };
            object redisCacheActivity = new RedisCacheActivity(mockResourceCatalog.Object, null);

            //---------------Assert Precondition----------------
            Assert.IsNotNull(redisRemoveActivity);
            Assert.IsNotNull(redisCacheActivity);
            //---------------Execute Test ----------------------
            var equals = redisRemoveActivity.Equals(redisCacheActivity);

            //---------------Test Result -----------------------
            Assert.IsFalse(equals);
        }