public void SetUp()
        {
            var mockRepo = new Mock <ISqlRepository <NzbGetSettings> >();

            ExpectedGetLinks = new List <NzbGetSettings>
            {
                new NzbGetSettings
                {
                    Id = 1, Enabled = true, IpAddress = "192", Password = "******", Port = 25, Username = "******", ShowOnDashboard = true
                }
            };
            ExpectedLink = new NzbGetSettings
            {
                Id              = 1,
                Enabled         = true,
                IpAddress       = "192",
                Password        = "******",
                Port            = 25,
                Username        = "******",
                ShowOnDashboard = true
            };

            mockRepo.Setup(x => x.GetAll()).Returns(ExpectedGetLinks).Verifiable();

            mockRepo.Setup(x => x.Get(1)).Returns(ExpectedLink).Verifiable();

            mockRepo.Setup(x => x.Update(It.IsAny <NzbGetSettings>())).Returns(true).Verifiable();

            mockRepo.Setup(x => x.Insert(It.IsAny <NzbGetSettings>())).Returns(1).Verifiable();

            MockRepo = mockRepo;
            Service  = new NzbGetSettingsService(mockRepo.Object);
        }
        public ActionResult NzbGetSettings(NzbGetSettingsViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            var dto = new NzbGetSettingsDto();

            dto.InjectFrom(viewModel);

            var result = NzbGetSettingsService.SaveSettings(dto);

            if (result)
            {
                return(RedirectToAction("NzbGetSettings"));
            }

            return(View("Error"));
        }