public void DsfDropBoxDeleteActivity_DropBoxSource_Same_Object_Is_Equal() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var mockDropboxClient = new Mock <IDropboxClient>(); var mockDropboxClientFactory = new Mock <IDropboxClientFactory>(); mockDropboxClientFactory.Setup(o => o.New(It.IsAny <string>(), It.IsAny <HttpClient>())).Returns(mockDropboxClient.Object); using (var dropBoxDeleteActivity = new DsfDropBoxDeleteActivityMock(mockDropboxClientFactory.Object) { UniqueID = uniqueId, Result = "A" }) { dropBoxDeleteActivity.SetupDropboxClient(""); var dropBoxDeleteActivity1 = new DsfDropBoxDeleteActivity { UniqueID = uniqueId, Result = "A" }; //---------------Assert Precondition---------------- Assert.IsTrue(dropBoxDeleteActivity.Equals(dropBoxDeleteActivity1)); //---------------Execute Test ---------------------- dropBoxDeleteActivity.SelectedSource = new DropBoxSource(); dropBoxDeleteActivity1.SelectedSource = new DropBoxSource(); var @equals = dropBoxDeleteActivity.Equals(dropBoxDeleteActivity1); //---------------Test Result ----------------------- Assert.IsTrue(equals); } }
public void DsfDropBoxDeleteActivity_Equals_IsEqual_ExpectTrue() { //-----------------------Arrange---------------------------- var dsfDropBoxDeleteAcivtity = new DsfDropBoxDeleteActivity(); //-----------------------Act-------------------------------- //-----------------------Assert----------------------------- Assert.IsTrue(dsfDropBoxDeleteAcivtity.Equals(dsfDropBoxDeleteAcivtity)); }
public void DsfDropBoxDeleteActivity_GetState_ReturnsStateVariable() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid(); var selectedSource = new MockOAuthSource(uniqueId); //------------Setup for test-------------------------- var dropBoxDeleteActivity = new DsfDropBoxDeleteActivity { SelectedSource = selectedSource, DeletePath = "Path", Result = "Deleted" }; //------------Execute Test--------------------------- var stateItems = dropBoxDeleteActivity.GetState(); Assert.AreEqual(3, stateItems.Count()); var expectedResults = new[] { new StateVariable { Name = "SelectedSource.ResourceID", Type = StateVariable.StateType.Input, Value = uniqueId.ToString() }, new StateVariable { Name = "DeletePath", Type = StateVariable.StateType.Input, Value = "Path" }, new StateVariable { Name = "Result", Type = StateVariable.StateType.Output, Value = "Deleted" } }; var iter = dropBoxDeleteActivity.GetState().Select( (item, index) => new { value = item, expectValue = expectedResults[index] } ); //------------Assert Results------------------------- foreach (var entry in iter) { Assert.AreEqual(entry.expectValue.Name, entry.value.Name); Assert.AreEqual(entry.expectValue.Type, entry.value.Type); Assert.AreEqual(entry.expectValue.Value, entry.value.Value); } }
public void DsfDropBoxDeleteActivity_Equals_Given_Same_Object_IsEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var multiAssign = new DsfDropBoxDeleteActivity { UniqueID = uniqueId, DisplayName = "a" }; var multiAssign1 = new DsfDropBoxDeleteActivity { UniqueID = uniqueId, DisplayName = "a" }; //---------------Assert Precondition---------------- Assert.IsNotNull(multiAssign); //---------------Execute Test ---------------------- var @equals = multiAssign.Equals(multiAssign1); //---------------Test Result ----------------------- Assert.IsTrue(equals); }
public void DsfDropBoxDeleteActivity_UniqueID_Different_Object_Is_Not_Equal() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var multiAssign = new DsfDropBoxDeleteActivity { UniqueID = uniqueId }; var multiAssign1 = new DsfDropBoxDeleteActivity { UniqueID = Guid.NewGuid().ToString() }; //---------------Assert Precondition---------------- Assert.IsNotNull(multiAssign); //---------------Execute Test ---------------------- var @equals = multiAssign.Equals(multiAssign1); //---------------Test Result ----------------------- Assert.IsFalse(equals); }
public void DsfDropBoxDeleteActivity_UniqueIDEquals_EmptyDropBoxDeleteActivities_IsEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var multiAssign = new DsfDropBoxDeleteActivity { UniqueID = uniqueId }; var multiAssign1 = new DsfDropBoxDeleteActivity { UniqueID = uniqueId }; //---------------Assert Precondition---------------- Assert.IsNotNull(multiAssign); //---------------Execute Test ---------------------- var @equals = multiAssign.Equals(multiAssign1); //---------------Test Result ----------------------- Assert.IsTrue(equals); }
public void DsfDropBoxDeleteActivity_DeletePath_Different_Object_Is_Not_Equal_CaseSensitive() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var multiAssign = new DsfDropBoxDeleteActivity { UniqueID = uniqueId, DeletePath = "AAA" }; var multiAssign1 = new DsfDropBoxDeleteActivity { UniqueID = uniqueId, DeletePath = "aaa" }; //---------------Assert DsfDropBoxDeleteActivity---------------- Assert.IsNotNull(multiAssign); //---------------Execute Test ---------------------- var @equals = multiAssign.Equals(multiAssign1); //---------------Test Result ----------------------- Assert.IsFalse(equals); }
public void DsfDropBoxDeleteActivity_ObjectEquals_IsFalse_ExpectFalse() { //-----------------------Arrange---------------------------- var obj = new object(); var mockDropboxClient = new Mock <IDropboxClient>(); var mockDropboxClientFactory = new Mock <IDropboxClientFactory>(); mockDropboxClientFactory.Setup(o => o.New(It.IsAny <string>(), It.IsAny <HttpClient>())).Returns(mockDropboxClient.Object); using (var dsfDropBoxDeleteAcivtity = new DsfDropBoxDeleteActivityMock(mockDropboxClientFactory.Object)) { dsfDropBoxDeleteAcivtity.SetupDropboxClient(""); obj = new DsfDropBoxDeleteActivity(); //-----------------------Act-------------------------------- //-----------------------Assert----------------------------- Assert.IsFalse(dsfDropBoxDeleteAcivtity.Equals(obj)); } }
public void DropBoxSource_Same_Object_Is_Equal() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var dropBoxDeleteActivity = new DsfDropBoxDeleteActivity { UniqueID = uniqueId, Result = "A" }; var dropBoxDeleteActivity1 = new DsfDropBoxDeleteActivity { UniqueID = uniqueId, Result = "A" }; //---------------Assert Precondition---------------- Assert.IsTrue(dropBoxDeleteActivity.Equals(dropBoxDeleteActivity1)); //---------------Execute Test ---------------------- dropBoxDeleteActivity.SelectedSource = new DropBoxSource(); dropBoxDeleteActivity1.SelectedSource = new DropBoxSource(); var @equals = dropBoxDeleteActivity.Equals(dropBoxDeleteActivity1); //---------------Test Result ----------------------- Assert.IsTrue(equals); }
public void GivenIDragDeleteDropboxToolOntoTheDesignSurface() { var dropBoxDeleteTool = new DsfDropBoxDeleteActivity(); var modelItem = ModelItemUtils.CreateModelItem(dropBoxDeleteTool); var mockEnvironmentRepo = new Mock <IServerRepository>(); var mockEnvironmentModel = new Mock <IServer>(); var mockExecutionEnvironment = new Mock <IExecutionEnvironment>(); var mockResourcRepositorySetUp = new Mock <IResourceRepository>(); var mockEventAggregator = new Mock <IEventAggregator>(); var dropBoxSourceManager = new Mock <IDropboxSourceManager>(); var sources = new List <OauthSource>() { new DropBoxSource() { ResourceName = "Test Resource Name" } }; 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); mockResourcRepositorySetUp.Setup(repository => repository.FindSourcesByType <OauthSource>(mockEnvironmentModel.Object, It.IsAny <enSourceType>())) .Returns(sources); mockEnvironmentModel.Setup(model => model.ResourceRepository).Returns(mockResourcRepositorySetUp.Object); mockEnvironmentRepo.Setup(repository => repository.ActiveServer).Returns(mockEnvironmentModel.Object); mockEnvironmentRepo.Setup(repository => repository.FindSingle(It.IsAny <Expression <Func <IServer, bool> > >())).Returns(mockEnvironmentModel.Object); var mock = new Mock <IResourceCatalog>(); mock.Setup(catalog => catalog.GetResourceList <Resource>(It.IsAny <Guid>())).Returns(new List <IResource>()); var deleteViewModel = new DropBoxDeleteViewModel(modelItem, dropBoxSourceManager.Object); scenarioContext.Add("deleteViewModel", deleteViewModel); scenarioContext.Add("mockEnvironmentModel", mockEnvironmentModel); scenarioContext.Add("mockEventAggregator", mockEventAggregator.Object); }