Exemplo n.º 1
0
        public void RedisSourceDefinition_Equals_RedisServiceSource_Expected_True()
        {
            const AuthenticationType expectedAuthenticationType = AuthenticationType.Password;
            var          expectedId       = Guid.NewGuid();
            const string expectedName     = "testResourceName";
            const string expectedPassword = "******";
            const string expectedHostName = "testHost";

            var mockRedisSource = new Mock <IRedisSource>();

            mockRedisSource.Setup(redisSource => redisSource.HostName).Returns(expectedHostName);
            mockRedisSource.Setup(redisSource => redisSource.ResourceID).Returns(expectedId);
            mockRedisSource.Setup(redisSource => redisSource.ResourceName).Returns(expectedName);
            mockRedisSource.Setup(redisSource => redisSource.Password).Returns(expectedPassword);
            mockRedisSource.Setup(redisSource => redisSource.AuthenticationType).Returns(expectedAuthenticationType);

            var redisSourceDefinition = new RedisSourceDefinition(mockRedisSource.Object);

            var mockRedisServiceSource = new Mock <IRedisServiceSource>();

            mockRedisServiceSource.Setup(redisServiceSource => redisServiceSource.HostName).Returns(expectedHostName);
            mockRedisServiceSource.Setup(redisServiceSource => redisServiceSource.Id).Returns(expectedId);
            mockRedisServiceSource.Setup(redisServiceSource => redisServiceSource.Name).Returns(expectedName);
            mockRedisServiceSource.Setup(redisServiceSource => redisServiceSource.Password).Returns(expectedPassword);
            mockRedisServiceSource.Setup(redisServiceSource => redisServiceSource.AuthenticationType).Returns(expectedAuthenticationType);

            var isEqual = redisSourceDefinition.Equals(mockRedisServiceSource.Object);

            Assert.IsTrue(isEqual);
        }
Exemplo n.º 2
0
        public void RedisSourceDefinition_Equals_Object_GetType_Expected_False()
        {
            const AuthenticationType expectedAuthenticationType = AuthenticationType.Password;
            var          expectedId       = Guid.NewGuid();
            const string expectedName     = "testResourceName";
            const string expectedPassword = "******";
            const string expectedHostName = "testHost";
            const string expectedPath     = "testPath";

            var mockRedisSource = new Mock <IRedisSource>();

            mockRedisSource.Setup(redisSource => redisSource.AuthenticationType).Returns(expectedAuthenticationType);
            mockRedisSource.Setup(redisSource => redisSource.ResourceID).Returns(expectedId);
            mockRedisSource.Setup(redisSource => redisSource.ResourceName).Returns(expectedName);
            mockRedisSource.Setup(redisSource => redisSource.Password).Returns(expectedPassword);
            mockRedisSource.Setup(redisSource => redisSource.HostName).Returns(expectedHostName);
            mockRedisSource.Setup(redisSource => redisSource.GetSavePath()).Returns(expectedPath);

            var redisSourceDefinition = new RedisSourceDefinition(mockRedisSource.Object);

            var redisSourceObj = new object();

            var isEqual = redisSourceDefinition.Equals(redisSourceObj);

            Assert.IsFalse(isEqual);
        }
Exemplo n.º 3
0
        public void RedisSourceDefinition_Equals_RedisServiceSource_Null_Expected_False()
        {
            var redisSourceDefinition = new RedisSourceDefinition();

            const IRedisServiceSource redisServiceSource = null;

            var isEqual = redisSourceDefinition.Equals(redisServiceSource);

            Assert.IsFalse(isEqual);
        }
Exemplo n.º 4
0
        public void RedisSourceDefinition_Equals_Object_Null_Expected_False()
        {
            var redisSourceDefinition = new RedisSourceDefinition();

            const object redisSource = null;

            var isEqual = redisSourceDefinition.Equals(redisSource);

            Assert.IsFalse(isEqual);
        }
Exemplo n.º 5
0
        public void RedisSourceDefinition_Equals_RedisSourceDefinition_Null_Expected_False()
        {
            var redisSourceDefinition = new RedisSourceDefinition();

            const RedisSourceDefinition nullRedisSourceDefinition = null;

            var isEqual = redisSourceDefinition.Equals(nullRedisSourceDefinition);

            Assert.IsFalse(isEqual);
        }