public void WebServiceSourceDefinition_Equals_Object_GetType_Expected_False() { const AuthenticationType expectedAuthenticationType = AuthenticationType.Public; const string expectedDefaultQuery = "testDefaultQuery"; var expectedId = Guid.NewGuid(); const string expectedName = "testResourceName"; const string expectedPassword = "******"; const string expectedHostName = "testHost"; const string expectedPath = "testPath"; const string expectedUserName = "******"; var mockWebSource = new Mock <IWebSource>(); mockWebSource.Setup(webSource => webSource.AuthenticationType).Returns(expectedAuthenticationType); mockWebSource.Setup(webSource => webSource.DefaultQuery).Returns(expectedDefaultQuery); mockWebSource.Setup(webSource => webSource.ResourceID).Returns(expectedId); mockWebSource.Setup(webSource => webSource.ResourceName).Returns(expectedName); mockWebSource.Setup(webSource => webSource.Password).Returns(expectedPassword); mockWebSource.Setup(webSource => webSource.Address).Returns(expectedHostName); mockWebSource.Setup(webSource => webSource.GetSavePath()).Returns(expectedPath); mockWebSource.Setup(webSource => webSource.UserName).Returns(expectedUserName); var webServiceSourceDefinition = new WebServiceSourceDefinition(mockWebSource.Object); var webSourceObj = new object(); var isEqual = webServiceSourceDefinition.Equals(webSourceObj); Assert.IsFalse(isEqual); }
public void WebServiceSourceDefinition_ReferenceEquals_WebServiceSource_Expected_True() { const AuthenticationType expectedAuthenticationType = AuthenticationType.Public; const string expectedDefaultQuery = "testDefaultQuery"; var expectedId = Guid.NewGuid(); const string expectedName = "testResourceName"; const string expectedPassword = "******"; const string expectedHostName = "testHost"; const string expectedUserName = "******"; var mockWebSource = new Mock <IWebSource>(); mockWebSource.Setup(webSource => webSource.Address).Returns(expectedHostName); mockWebSource.Setup(webSource => webSource.ResourceID).Returns(expectedId); mockWebSource.Setup(webSource => webSource.ResourceName).Returns(expectedName); mockWebSource.Setup(webSource => webSource.UserName).Returns(expectedUserName); mockWebSource.Setup(webSource => webSource.Password).Returns(expectedPassword); mockWebSource.Setup(webSource => webSource.AuthenticationType).Returns(expectedAuthenticationType); mockWebSource.Setup(webSource => webSource.DefaultQuery).Returns(expectedDefaultQuery); IWebServiceSource webServiceSourceDefinition = new WebServiceSourceDefinition(mockWebSource.Object); var isEqual = webServiceSourceDefinition.Equals(webServiceSourceDefinition); Assert.IsTrue(isEqual); }
public void WebServiceSourceDefinition_Equals_WebServiceSource_Null_Expected_False() { var webServiceSourceDefinition = new WebServiceSourceDefinition(); const IWebServiceSource webServiceSource = null; var isEqual = webServiceSourceDefinition.Equals(webServiceSource); Assert.IsFalse(isEqual); }
public void SavedSource_Itself_Is_Equal() { //---------------Set up test pack------------------- var webServiceSourceDefinition = new WebServiceSourceDefinition { Id = Guid.NewGuid(), Path = "A" }; //---------------Assert Precondition---------------- Assert.IsTrue(webServiceSourceDefinition.Equals(webServiceSourceDefinition), "Equals operator can't compare to itself."); }
public void SavedSource_Null_Object_Is_NotEqual() { //---------------Set up test pack------------------- var webServiceSourceDefinition = new WebServiceSourceDefinition { Id = Guid.NewGuid(), Path = "A" }; //---------------Assert Precondition---------------- Assert.IsFalse(webServiceSourceDefinition.Equals(null), "Equals operator can't compare to null."); }
public void SavedSource_DifferentType_Is_NotEqual() { //---------------Set up test pack------------------- var webServiceSourceDefinition = new WebServiceSourceDefinition { Name = "bravo" }; object differentObject = new DsfWebGetActivity { SourceId = Guid.NewGuid(), ActionName = "A" }; //---------------Assert Precondition---------------- Assert.IsFalse(webServiceSourceDefinition.Equals(differentObject), "Equals operator can't compare to differently typed object."); }