public void CheckPrerequisitiesTest_ShouldFail() { //arrange MigrationFlowData flowData = new MigrationFlowData(); flowData.VhdFileDestinationFolder = "destination\\folder"; this.fileSystemMock.Setup(x => x.File.Exists(It.IsAny <string>())) .Returns <string>((path) => { return(path == flowData.VhdFileDestinationFolder + "\\" ? true : false); }); CreateFinalVhdMigrationStep step = new CreateFinalVhdMigrationStep(loggerMock.Object, fileSystemHelperMock.Object, fileSystemMock.Object, flowData); //act string[] messages = new string[0]; bool result = step.CheckPrerequisities(ref messages); //assert Assert.IsFalse(result); Assert.AreEqual(1, messages.Where(x => x.Contains("already exists")).Count()); Assert.AreEqual(1, messages.Where(x => x.Contains("DISKPART was not found")).Count()); }
public void CheckPrerequisitiesTest_ShouldBeOk() { //arrange MigrationFlowData flowData = new MigrationFlowData(); flowData.VhdFileDestinationFolder = "destination\\folder"; this.fileSystemMock.Setup(x => x.File.Exists(It.IsAny <string>())) .Returns <string>((path) => { return(path == flowData.VhdFileDestinationFolder + "\\" ? false : true); }); CreateFinalVhdMigrationStep step = new CreateFinalVhdMigrationStep(loggerMock.Object, fileSystemHelperMock.Object, fileSystemMock.Object, flowData); //act string[] messages = new string[0]; bool result = step.CheckPrerequisities(ref messages); //assert Assert.IsTrue(result); }