public void ConvertButtonVisibilityIsFalseWhenTargetFoldersIsEmpty()
 {
     var vm = new DialogVm {
         ConvertedOfxDestinationFolder = string.Empty
     };
     Assert.AreEqual(false, vm.IsSaveButtonVisible);
 }
 public void ConvertButtonVisibilityIsFalseWhenSourceFoldersIsEmpty()
 {
     var vm = new DialogVm {
                           	StatementLocation = string.Empty
                           };
     Assert.AreEqual(false, vm.IsSaveButtonVisible);
 }
 public void ConvertButtonVisibilityIsFalseWhenSourceAndTargetFoldersAreEmpty()
 {
     var vm = new DialogVm();
     Assert.AreEqual(false, vm.IsSaveButtonVisible);
     vm.ConvertedOfxDestinationFolder = string.Empty;
     vm.StatementLocation = string.Empty;
     Assert.AreEqual(false, vm.IsSaveButtonVisible);
 }
 public void ConvertButtonVisibilityIsTrueWhenWhenTargetAndSourceFoldersAreNotEmpty()
 {
     // ReSharper disable UseObjectOrCollectionInitializer
     var vm = new DialogVm();
     // ReSharper restore UseObjectOrCollectionInitializer
     vm.ConvertedOfxDestinationFolder = "destination";
     vm.StatementLocation = "source";
     Assert.AreEqual(true, vm.IsSaveButtonVisible);
 }
        public void IsStatementLocationPopulatedIsFalseWhenSourceFolderIsEmpty()
        {
            var vm = new DialogVm();
            Assert.AreEqual(false, vm.IsStatementLocationPopulated);
            Assert.AreEqual(true, vm.IsStatementLocationEmpty);

            vm.StatementLocation = string.Empty;

            Assert.AreEqual(false, vm.IsStatementLocationPopulated);
            Assert.AreEqual(true, vm.IsStatementLocationEmpty);
        }
        public void ProgramExitsWhenStatementLocationIsEmptyString()
        {
            var fileHandler = new Mock<IFileHandler>(MockBehavior.Strict);
            fileHandler.Setup(x => x.ValidateFileLocation(It.IsAny<string>()));
            var parser = new Mock<IHtmlParser>(MockBehavior.Strict);
            parser.Setup(x => x.TidyStatement(It.IsAny<string>())).Returns(CopyResourceToString("ViewModelTests.Resources", "ExpectedTidiedTestStatement.htm"));

            var vm = new DialogVm(fileHandler.Object, parser.Object) { StatementLocation = string.Empty };
            vm.ConvertSmileToOfxStatementForDisplay();

            fileHandler.VerifyAll();
        }
        public void IsStatementLocationPopulatedIsTrueWhenSourceFolderIsPopulated()
        {
            var vm = new DialogVm {StatementLocation = "The statement location"};

            Assert.AreEqual(true, vm.IsStatementLocationPopulated);
            Assert.AreEqual(false, vm.IsStatementLocationEmpty);
        }
        public void SmileStatementIsConvertedToInMemoryOfxStatement()
        {
            var fileHandler = new Mock<IFileHandler>(MockBehavior.Strict);
            fileHandler.Setup(x => x.ValidateFileLocation(It.IsAny<string>()));
            var parser = new Mock<IHtmlParser>(MockBehavior.Strict);
            parser.Setup(x => x.TidyStatement(It.IsAny<string>())).Returns(CopyResourceToString("ViewModelTests.Resources", "ExpectedTidiedTestStatement.htm"));

            var vm = new DialogVm(fileHandler.Object, parser.Object) { StatementLocation = "The statement location" };
            vm.ConvertSmileToOfxStatementForDisplay();

            fileHandler.VerifyAll();
            Assert.AreEqual(5, vm.GetTransactions.Count);
            Assert.AreEqual("12344321", vm.AccountCode, "Account Code");
            Assert.AreEqual("084456", vm.SortCode, "Sort Code");
            Assert.AreEqual("04/04/2010", vm.StatementDate, "Statement Date");
        }