예제 #1
0
        public void TestRedisSource_Execute_GivenResourceDefinition_ShouldTestNewSourceReturnResourceDefinitionMsg()
        {
            //---------------Set up test pack-------------------
            var dependency = new Depends(Depends.ContainerType.AnonymousRedis);
            var serializer = new Dev2JsonSerializer();
            var source     = new RedisSourceDefinition()
            {
                Id                 = Guid.Empty,
                Name               = "Name",
                HostName           = dependency.Container.IP,
                Port               = dependency.Container.Port,
                AuthenticationType = Dev2.Runtime.ServiceModel.Data.AuthenticationType.Anonymous
            };
            var testRedisSource = new TestRedisSource();
            var values          = new Dictionary <string, StringBuilder>
            {
                { "RedisSource", source.SerializeToJsonStringBuilder() }
            };
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            var jsonResult = testRedisSource.Execute(values, null);
            var result     = serializer.Deserialize <ExecuteMessage>(jsonResult);

            //---------------Test Result -----------------------
            Assert.IsFalse(result.HasError, result.Message.ToString());
        }
예제 #2
0
        public void TestRedisSource_Execute_NullValues_ErrorResult()
        {
            //------------Setup for test--------------------------
            var testRedisSource = new TestRedisSource();
            var serializer      = new Dev2JsonSerializer();
            //------------Execute Test---------------------------
            var jsonResult = testRedisSource.Execute(null, null);
            var result     = serializer.Deserialize <ExecuteMessage>(jsonResult);

            //------------Assert Results-------------------------
            Assert.IsTrue(result.HasError);
        }
예제 #3
0
        public void TestRedisSource_Execute_ResourceIDNotPresent_ErrorResult()
        {
            //------------Setup for test--------------------------
            var values = new Dictionary <string, StringBuilder> {
                { "item", new StringBuilder() }
            };
            var testRedisSource = new TestRedisSource();
            var serializer      = new Dev2JsonSerializer();
            //------------Execute Test---------------------------
            var jsonResult = testRedisSource.Execute(values, null);
            var result     = serializer.Deserialize <ExecuteMessage>(jsonResult);

            //------------Assert Results-------------------------
            Assert.IsTrue(result.HasError);
        }