Пример #1
0
        public void SharePointServiceSourceDefinition_Equals_Object_GetType_Expected_False()
        {
            const AuthenticationType expectedAuthenticationType = AuthenticationType.Public;
            const string             expectedServer             = "localhost";
            const string             expectedPath = "";
            var          expectedResourceID       = Guid.NewGuid();
            const string expectedResourceName     = "testResourceName";
            const string expectedPassword         = "******";
            const string expectedUserName         = "******";

            var mockSharepointSource = new Mock <ISharepointSource>();

            mockSharepointSource.Setup(sharepointSource => sharepointSource.AuthenticationType).Returns(expectedAuthenticationType);
            mockSharepointSource.Setup(sharepointSource => sharepointSource.Server).Returns(expectedServer);
            mockSharepointSource.Setup(sharepointSource => sharepointSource.GetSavePath()).Returns(expectedPath);
            mockSharepointSource.Setup(sharepointSource => sharepointSource.ResourceID).Returns(expectedResourceID);
            mockSharepointSource.Setup(sharepointSource => sharepointSource.ResourceName).Returns(expectedResourceName);
            mockSharepointSource.Setup(sharepointSource => sharepointSource.Password).Returns(expectedPassword);
            mockSharepointSource.Setup(sharepointSource => sharepointSource.UserName).Returns(expectedUserName);

            var sharePointServiceSourceDefinition = new SharePointServiceSourceDefinition(mockSharepointSource.Object);

            var sharepointSourceObj = new object();

            var isEqual = sharePointServiceSourceDefinition.Equals(sharepointSourceObj);

            Assert.IsFalse(isEqual);
        }
Пример #2
0
        public void SharePointServiceSourceDefinition_Equals_SharepointSource_Expected_True()
        {
            const AuthenticationType expectedAuthenticationType = AuthenticationType.Public;
            const string             expectedServer             = "localhost";
            const string             expectedPassword           = "******";
            const string             expectedUserName           = "******";

            var mockSharepointSource = new Mock <ISharepointSource>();

            mockSharepointSource.Setup(sharepointSource => sharepointSource.Server).Returns(expectedServer);
            mockSharepointSource.Setup(sharepointSource => sharepointSource.UserName).Returns(expectedUserName);
            mockSharepointSource.Setup(sharepointSource => sharepointSource.Password).Returns(expectedPassword);
            mockSharepointSource.Setup(sharepointSource => sharepointSource.AuthenticationType).Returns(expectedAuthenticationType);

            var sharePointServiceSourceDefinition = new SharePointServiceSourceDefinition(mockSharepointSource.Object);

            var mockSharepointServerSource = new Mock <ISharepointServerSource>();

            mockSharepointServerSource.Setup(sharepointServerSource => sharepointServerSource.Server).Returns(expectedServer);
            mockSharepointServerSource.Setup(sharepointServerSource => sharepointServerSource.UserName).Returns(expectedUserName);
            mockSharepointServerSource.Setup(sharepointServerSource => sharepointServerSource.Password).Returns(expectedPassword);
            mockSharepointServerSource.Setup(sharepointServerSource => sharepointServerSource.AuthenticationType).Returns(expectedAuthenticationType);

            var isEqual = sharePointServiceSourceDefinition.Equals(mockSharepointServerSource.Object);

            Assert.IsTrue(isEqual);
        }
Пример #3
0
        public void SharePointServiceSourceDefinition_Equals_SharepointSource_Null_Expected_False()
        {
            var sharePointServiceSourceDefinition = new SharePointServiceSourceDefinition();

            const ISharepointServerSource sharepointServerSource = null;

            var isEqual = sharePointServiceSourceDefinition.Equals(sharepointServerSource);

            Assert.IsFalse(isEqual);
        }
Пример #4
0
        public void SharePointServiceSourceDefinition_Equals_SharePointServiceSourceDefinition_Null_Expected_False()
        {
            var sharePointServiceSourceDefinition = new SharePointServiceSourceDefinition();

            const SharePointServiceSourceDefinition nullSharePointServiceSourceDefinition = null;

            var isEqual = sharePointServiceSourceDefinition.Equals(nullSharePointServiceSourceDefinition);

            Assert.IsFalse(isEqual);
        }
        public void SavedSource_Itself_Is_Equal()
        {
            //---------------Set up test pack-------------------
            var sharePointServiceSourceDefinition = new SharePointServiceSourceDefinition
            {
                Id     = Guid.NewGuid(),
                Server = "A"
            };

            //---------------Assert Precondition----------------
            Assert.IsTrue(sharePointServiceSourceDefinition.Equals(sharePointServiceSourceDefinition), "Equals operator can't compare to itself.");
        }
        public void SavedSource_Null_Object_Is_NotEqual()
        {
            //---------------Set up test pack-------------------
            var sharePointServiceSourceDefinition = new SharePointServiceSourceDefinition
            {
                Id     = Guid.NewGuid(),
                Server = "A"
            };

            //---------------Assert Precondition----------------
            Assert.IsFalse(sharePointServiceSourceDefinition.Equals(null), "Equals operator can't compare to null.");
        }
        public void SavedSource_DifferentType_Is_NotEqual()
        {
            //---------------Set up test pack-------------------
            var sharePointServiceSourceDefinition = new SharePointServiceSourceDefinition
            {
                Id     = Guid.NewGuid(),
                Server = "A"
            };
            object differentObject = new SharepointSearchTo
            {
                InternalName = Guid.NewGuid().ToString(),
                FieldName    = "A"
            };

            //---------------Assert Precondition----------------
            Assert.IsFalse(sharePointServiceSourceDefinition.Equals(differentObject), "Equals operator can't compare to differently typed object.");
        }