public void DsfDropBoxUploadActivity_OverWriteMode_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 dsfDropBoxUploadActivity = new TestDsfDropBoxUploadActivity(mockDropboxClientFactory.Object) { UniqueID = uniqueId, Result = "A" }) { dsfDropBoxUploadActivity.SetupDropboxClient(""); var dsfDropBoxUploadActivityOther = new DsfDropBoxUploadActivity { UniqueID = uniqueId, Result = "A" }; //---------------Assert Precondition---------------- Assert.IsTrue(dsfDropBoxUploadActivity.Equals(dsfDropBoxUploadActivityOther)); //---------------Execute Test ---------------------- dsfDropBoxUploadActivity.OverWriteMode = true; dsfDropBoxUploadActivityOther.OverWriteMode = true; var @equals = dsfDropBoxUploadActivity.Equals(dsfDropBoxUploadActivityOther); //---------------Test Result ----------------------- Assert.IsTrue(@equals); } }
public void DsfDropBoxUploadActivity_Equals_IsNull_ExpectFalse() { //-----------------------Arrange---------------------------- 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 dsfDropBoxUploadActivity = new TestDsfDropBoxUploadActivity(mockDropboxClientFactory.Object)) { //-----------------------Act-------------------------------- dsfDropBoxUploadActivity.SetupDropboxClient(""); //-----------------------Assert----------------------------- Assert.IsFalse(dsfDropBoxUploadActivity.Equals(null)); } }
public void DsfDropBoxUploadActivity_PerformExecution_GetDebugInputs_Null_ExpertSuccess() { //--------------------------Arrange---------------------------- 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 dsfDropBoxUploadActivity = new TestDsfDropBoxUploadActivity(mockDropboxClientFactory.Object)) { dsfDropBoxUploadActivity.SetupDropboxClient(""); //--------------------------Act-------------------------------- var list = dsfDropBoxUploadActivity.GetDebugInputs(null, 0); //--------------------------Assert----------------------------- Assert.AreEqual(0, list.Count); } }
public void DsfDropBoxUploadActivity_GetHashCode_Properties_IsNull_ExpertTrue() { //--------------------------Arrange---------------------------- 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 dsfDropBoxUploadActivity = new TestDsfDropBoxUploadActivity(mockDropboxClientFactory.Object)) { dsfDropBoxUploadActivity.SetupDropboxClient(""); //--------------------------Act-------------------------------- var getHash = dsfDropBoxUploadActivity.GetHashCode(); //--------------------------Assert----------------------------- Assert.IsNotNull(getHash); } }
public void DsfDropBoxUploadActivity_GetState_ReturnsStateVariable() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid(); var selectedSource = new MockOAuthSource(uniqueId); var mockDropboxClient = new Mock <IDropboxClient>(); var mockDropboxClientFactory = new Mock <IDropboxClientFactory>(); mockDropboxClientFactory.Setup(o => o.New(It.IsAny <string>(), It.IsAny <HttpClient>())).Returns(mockDropboxClient.Object); //------------Setup for test-------------------------- using (var dropBoxUploadActivity = new TestDsfDropBoxUploadActivity(mockDropboxClientFactory.Object) { SelectedSource = selectedSource, FromPath = "Path_From", ToPath = "Path_To", OverWriteMode = false, Result = "Uploaded" }) { dropBoxUploadActivity.SetupDropboxClient(""); //------------Execute Test--------------------------- var stateItems = dropBoxUploadActivity.GetState(); Assert.AreEqual(5, stateItems.Count()); var expectedResults = new[] { new StateVariable { Name = "SelectedSource.ResourceID", Type = StateVariable.StateType.Input, Value = uniqueId.ToString() }, new StateVariable { Name = "FromPath", Type = StateVariable.StateType.Input, Value = "Path_From" }, new StateVariable { Name = "ToPath", Type = StateVariable.StateType.Input, Value = "Path_To" }, new StateVariable { Name = "OverWriteMode", Type = StateVariable.StateType.Input, Value = "False" }, new StateVariable { Name = "Result", Type = StateVariable.StateType.Output, Value = "Uploaded" } }; var iter = dropBoxUploadActivity.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); } } }