public void DsfDropBoxDownloadActivity_OverwriteFile_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 dsfDropBoxDownloadActivity = new TestDsfDropBoxDownloadActivity(mockDropboxClientFactory.Object) { UniqueID = uniqueId, Result = "A" }) { dsfDropBoxDownloadActivity.SetupDropboxClient(""); var dsfDropBoxDownloadActivityOther = new TestDsfDropBoxDownloadActivity { UniqueID = uniqueId, Result = "A" }; //---------------Assert Precondition---------------- Assert.IsTrue(dsfDropBoxDownloadActivity.Equals(dsfDropBoxDownloadActivityOther)); //---------------Execute Test ---------------------- dsfDropBoxDownloadActivity.OverwriteFile = true; dsfDropBoxDownloadActivityOther.OverwriteFile = true; var @equals = dsfDropBoxDownloadActivity.Equals(dsfDropBoxDownloadActivityOther); //---------------Test Result ----------------------- Assert.IsTrue(@equals); } }
public void DsfDropBoxDownloadActivity_Equals_IsNull_ExpectFalse() { var mockDropboxClient = new Mock <IDropboxClient>(); var mockDropboxClientFactory = new Mock <IDropboxClientFactory>(); mockDropboxClientFactory.Setup(o => o.New(It.IsAny <string>(), It.IsAny <HttpClient>())).Returns(mockDropboxClient.Object); //-----------------------Arrange---------------------------- using (var dsfDropBoxDownloadActivity = new TestDsfDropBoxDownloadActivity(mockDropboxClientFactory.Object)) { //-----------------------Act-------------------------------- dsfDropBoxDownloadActivity.SetupDropboxClient(""); //-----------------------Assert----------------------------- Assert.IsFalse(dsfDropBoxDownloadActivity.Equals(null)); } }
public void DsfDropBoxDownloadActivity_ObjectEquals_IsTrue_ExpectTrue() { //-----------------------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 dsfDropBoxDownloadActivity = new TestDsfDropBoxDownloadActivity(mockDropboxClientFactory.Object)) { dsfDropBoxDownloadActivity.SetupDropboxClient(""); obj = dsfDropBoxDownloadActivity; //-----------------------Act-------------------------------- //-----------------------Assert----------------------------- Assert.IsTrue(dsfDropBoxDownloadActivity.Equals(obj)); } }