public void WcfServiceSourceDefinition_RefEquals_Object_As_WcfServiceSourceDefinition_Expected_True() { const string expectedResourceName = "testResourceName"; var expectedResourceID = Guid.NewGuid(); const string expectedEndpointUrl = "testEndpointUrl"; const string expectedName = "testName"; const string expectedPath = "testPath"; var expectedId = Guid.NewGuid(); const enSourceType expectedType = enSourceType.WcfSource; const string expectedResourceType = "WcfSource"; var wcfServiceSourceDefinition = new WcfServiceSourceDefinition { ResourceName = expectedResourceName, ResourceID = expectedResourceID, EndpointUrl = expectedEndpointUrl, Name = expectedName, Path = expectedPath, Id = expectedId, Type = expectedType, ResourceType = expectedResourceType }; object wcfServiceSource = wcfServiceSourceDefinition; var isEqual = wcfServiceSourceDefinition.Equals(wcfServiceSource); Assert.IsTrue(isEqual); }
public void WcfServiceSourceDefinition_Validate() { const string expectedResourceName = "testResourceName"; var expectedResourceID = Guid.NewGuid(); const string expectedEndpointUrl = "testEndpointUrl"; const string expectedName = "testName"; const string expectedPath = "testPath"; var expectedId = Guid.NewGuid(); const enSourceType expectedType = enSourceType.WcfSource; const string expectedResourceType = "WcfSource"; var wcfServiceSourceDefinition = new WcfServiceSourceDefinition { ResourceName = expectedResourceName, ResourceID = expectedResourceID, EndpointUrl = expectedEndpointUrl, Name = expectedName, Path = expectedPath, Id = expectedId, Type = expectedType, ResourceType = expectedResourceType }; Assert.AreEqual(expectedResourceName, wcfServiceSourceDefinition.ResourceName); Assert.AreEqual(expectedResourceID, wcfServiceSourceDefinition.ResourceID); Assert.AreEqual(expectedEndpointUrl, wcfServiceSourceDefinition.EndpointUrl); Assert.AreEqual(expectedName, wcfServiceSourceDefinition.Name); Assert.AreEqual(expectedPath, wcfServiceSourceDefinition.Path); Assert.AreEqual(expectedId, wcfServiceSourceDefinition.Id); Assert.AreEqual(expectedType, wcfServiceSourceDefinition.Type); Assert.AreEqual(expectedResourceType, wcfServiceSourceDefinition.ResourceType); }
public void WcfServiceSourceDefinition_GetHashCode_Not_Equal_To_Zero() { const string expectedResourceName = "testResourceName"; var expectedResourceID = Guid.NewGuid(); const string expectedEndpointUrl = "testEndpointUrl"; const string expectedName = "testName"; const string expectedPath = "testPath"; var expectedId = Guid.NewGuid(); const enSourceType expectedType = enSourceType.WcfSource; const string expectedResourceType = "WcfSource"; var wcfServiceSourceDefinition = new WcfServiceSourceDefinition { ResourceName = expectedResourceName, ResourceID = expectedResourceID, EndpointUrl = expectedEndpointUrl, Name = expectedName, Path = expectedPath, Id = expectedId, Type = expectedType, ResourceType = expectedResourceType }; var hashCode = wcfServiceSourceDefinition.GetHashCode(); Assert.AreNotEqual(0, hashCode); }
public ManageWcfSourceViewModel GetModel() { var sourceModel = new WcfServiceSourceDefinition() { Id = Guid.NewGuid(), Name = "TestWcf", EndpointUrl = "http/test/com" }; var updateManager = new Mock <IWcfSourceModel>(); updateManager.Setup(model => model.ServerName).Returns("Test"); updateManager.Setup(model => model.FetchSource(It.IsAny <Guid>())).Returns(sourceModel); var asyncWorker = new Mock <IAsyncWorker>(); asyncWorker.Setup(worker => worker.Start(It.IsAny <Func <IWcfServerSource> >(), It.IsAny <Action <IWcfServerSource> >())) .Callback <Func <IWcfServerSource>, Action <IWcfServerSource> >((func, action) => { var wcfSource = func.Invoke(); action(wcfSource); }); var manageWcfSourceViewModel = new ManageWcfSourceViewModel(updateManager.Object, new Microsoft.Practices.Prism.PubSubEvents.EventAggregator(), sourceModel, asyncWorker.Object, new Mock <IServer>().Object); return(manageWcfSourceViewModel); }
public void WcfServiceSourceDefinition_GetHashCode_Expect_Zero() { var wcfServiceSourceDefinition = new WcfServiceSourceDefinition(); var hashCode = wcfServiceSourceDefinition.GetHashCode(); Assert.AreEqual(0, hashCode); }
public IWcfServerSource FetchSource(Guid resourceID) { var xaml = _queryProxy.FetchResourceXaml(resourceID); var wcfsource = new WcfSource(xaml.ToXElement()); var def = new WcfServiceSourceDefinition(wcfsource); return(def); }
public void WcfServiceSourceDefinition_Equals_WcfServerSource_Null_Expected_False() { var wcfServiceSourceDefinition = new WcfServiceSourceDefinition(); const IWcfServerSource wcfServerSource = null; var isEqual = wcfServiceSourceDefinition.Equals(wcfServerSource); Assert.IsFalse(isEqual); }
public void WcfServiceSourceDefinition_Equals_Null_Object_As_Unknown_Expected_False() { var wcfServiceSourceDefinition = new WcfServiceSourceDefinition(); var wcfServiceSource = new object(); var isEqual = wcfServiceSourceDefinition.Equals(wcfServiceSource); Assert.IsFalse(isEqual); }
public void NotEqualsOperator_WithNotEqualObjects_AreNotEqual() { var firstWcfServiceSourceDefinition = new WcfServiceSourceDefinition { EndpointUrl = "bravo" }; var secondWcfServiceSourceDefinition = new WcfServiceSourceDefinition { EndpointUrl = "charlie" }; Assert.IsTrue(firstWcfServiceSourceDefinition != secondWcfServiceSourceDefinition, "Not equals operator doesnt work."); }
public void SavedSource_Itself_Is_Equal() { //---------------Set up test pack------------------- var wcfServiceSourceDefinition = new WcfServiceSourceDefinition { Id = Guid.NewGuid(), Path = "A" }; //---------------Assert Precondition---------------- Assert.IsTrue(wcfServiceSourceDefinition.Equals(wcfServiceSourceDefinition), "Equals operator can't compare to itself."); }
public void SavedSource_Null_Object_Is_NotEqual() { //---------------Set up test pack------------------- var wcfServiceSourceDefinition = new WcfServiceSourceDefinition { Id = Guid.NewGuid(), Path = "A" }; //---------------Assert Precondition---------------- Assert.IsFalse(wcfServiceSourceDefinition.Equals(null), "Equals operator can't compare to null."); }
public void WcfServiceSourceDefinition_ReferenceEquals_WcfServerSource_Expected_True() { const string expectedEndpointUrl = "testEndpointUrl"; IWcfServerSource wcfServiceSourceDefinition = new WcfServiceSourceDefinition { EndpointUrl = expectedEndpointUrl }; var isEqual = wcfServiceSourceDefinition.Equals(wcfServiceSourceDefinition); Assert.IsTrue(isEqual); }
public void SavedSource_DifferentType_Is_NotEqual() { //---------------Set up test pack------------------- var wcfServiceSourceDefinition = new WcfServiceSourceDefinition { EndpointUrl = "bravo" }; object differentObject = new ActivityDTO { IndexNumber = 0, FieldName = "A" }; //---------------Assert Precondition---------------- Assert.IsFalse(wcfServiceSourceDefinition.Equals(differentObject), "Equals operator can't compare to differently typed object."); }
public IWcfServerSource FetchSource(Guid resourceID) { var xaml = _queryProxy.FetchResourceXaml(resourceID); var wcfsource = new WcfSource(xaml.ToXElement()); var def = new WcfServiceSourceDefinition { Id = wcfsource.Id, Name = wcfsource.ResourceName, Path = wcfsource.GetSavePath(), ResourceName = wcfsource.Name, EndpointUrl = wcfsource.EndpointUrl }; return(def); }
public void WcfServiceSourceDefinition_Equals_WcfServerSource_Expected_True() { const string expectedEndpointUrl = "testEndpointUrl"; var wcfServiceSourceDefinition = new WcfServiceSourceDefinition { EndpointUrl = expectedEndpointUrl }; var mockWcfServerSource = new Mock <IWcfServerSource>(); mockWcfServerSource.Setup(wcfServerSource => wcfServerSource.EndpointUrl).Returns(expectedEndpointUrl); var isEqual = wcfServiceSourceDefinition.Equals(mockWcfServerSource.Object); Assert.IsTrue(isEqual); }
public void GivenIOpenNewWcfTool() { var activity = new DsfWcfEndPointActivity(); var modelItem = ModelItemUtils.CreateModelItem(activity); var mockServiceInputViewModel = new Mock <IManageWcfSourceViewModel>(); var mockDbServiceModel = new Mock <IWcfServiceModel>(); var mockEnvironmentRepo = new Mock <IServerRepository>(); var mockEnvironmentModel = new Mock <IServer>(); mockEnvironmentModel.Setup(model => model.IsConnected).Returns(true); mockEnvironmentModel.Setup(model => model.IsLocalHost).Returns(true); mockEnvironmentModel.Setup(model => model.EnvironmentID).Returns(Guid.Empty); mockEnvironmentModel.Setup(model => model.IsLocalHostCheck()).Returns(false); mockEnvironmentRepo.Setup(repository => repository.ActiveServer).Returns(mockEnvironmentModel.Object); mockEnvironmentRepo.Setup(repository => repository.FindSingle(It.IsAny <Expression <Func <IServer, bool> > >())).Returns(mockEnvironmentModel.Object); var src = new WcfServiceSourceDefinition() { Name = "Echo", Id = Guid.NewGuid(), Path = "k:\\bob.dll", EndpointUrl = "Https:/localhost" }; var srcs = new ObservableCollection <IWcfServerSource> { src }; mockDbServiceModel.Setup(model => model.RetrieveSources()).Returns(srcs); mockDbServiceModel.Setup(a => a.GetActions(src)).Returns(new List <IWcfAction> { new WcfAction() { FullName = "Echome" } }); mockServiceInputViewModel.SetupAllProperties(); var resource = new Mock <IContextualResourceModel>(); resource.Setup(a => a.GetErrors(It.IsAny <Guid>())).Returns(new ObservableReadOnlyList <IErrorInfo>()); var sqlServerDesignerViewModel = new WcfEndPointViewModel(modelItem, mockDbServiceModel.Object); scenarioContext.Add("viewModel", sqlServerDesignerViewModel); scenarioContext.Add("mockServiceInputViewModel", mockServiceInputViewModel); scenarioContext.Add("mockDbServiceModel", mockDbServiceModel); }
public void WcfServiceSourceDefinition_Equals_WcfServiceSourceDefinition_Expected_True() { const string expectedEndpointUrl = "testEndpointUrl"; var wcfServiceSourceDefinition = new WcfServiceSourceDefinition { EndpointUrl = expectedEndpointUrl }; var wcfServiceSourceDefinitionDup = new WcfServiceSourceDefinition { EndpointUrl = expectedEndpointUrl }; var isEqual = wcfServiceSourceDefinition.Equals(wcfServiceSourceDefinitionDup); Assert.IsTrue(isEqual); Assert.IsTrue(wcfServiceSourceDefinition == wcfServiceSourceDefinitionDup); }