Ejemplo n.º 1
0
        public void GetCouchPotatoSettings()
        {
            var expectedDto = new CouchPotatoSettingsDto
            {
                Enabled         = true,
                Id              = 2,
                IpAddress       = "192",
                ApiKey          = "pass",
                Port            = 2,
                ShowOnDashboard = true,
                Password        = "******",
                Username        = "******"
            };
            var settingsMock = new Mock <ISettingsService <CouchPotatoSettingsDto> >();

            settingsMock.Setup(x => x.GetSettings()).Returns(expectedDto).Verifiable();

            _controller = new SettingsController(null, null, null, settingsMock.Object, null, null, null, null, null, Logger);
            _controller.WithCallTo(x => x.CouchPotatoSettings()).ShouldRenderDefaultView();

            var result = (ViewResult)_controller.CouchPotatoSettings();
            var model  = (CouchPotatoSettingsViewModel)result.Model;

            Assert.That(model.Enabled, Is.EqualTo(expectedDto.Enabled));
            Assert.That(model.Id, Is.EqualTo(expectedDto.Id));
            Assert.That(model.IpAddress, Is.EqualTo(expectedDto.IpAddress));
            Assert.That(model.ApiKey, Is.EqualTo(expectedDto.ApiKey));
            Assert.That(model.Port, Is.EqualTo(expectedDto.Port));
            Assert.That(model.ShowOnDashboard, Is.EqualTo(expectedDto.ShowOnDashboard));
            Assert.That(model.Username, Is.EqualTo(expectedDto.Username));
            Assert.That(model.Password, Is.EqualTo(expectedDto.Password));
        }
Ejemplo n.º 2
0
        public void GetCouchPotatoSettings()
        {
            var expectedDto = new CouchPotatoSettingsDto
            {
                Enabled = true,
                Id = 2,
                IpAddress = "192",
                ApiKey = "pass",
                Port = 2,
                ShowOnDashboard = true,
                Password = "******",
                Username = "******"
            };
            var settingsMock = new Mock<ISettingsService<CouchPotatoSettingsDto>>();

            settingsMock.Setup(x => x.GetSettings()).Returns(expectedDto).Verifiable();

            _controller = new SettingsController(null, null, null, settingsMock.Object, null, null, null, null, null, Logger);
            _controller.WithCallTo(x => x.CouchPotatoSettings()).ShouldRenderDefaultView();

            var result = (ViewResult)_controller.CouchPotatoSettings();
            var model = (CouchPotatoSettingsViewModel)result.Model;

            Assert.That(model.Enabled, Is.EqualTo(expectedDto.Enabled));
            Assert.That(model.Id, Is.EqualTo(expectedDto.Id));
            Assert.That(model.IpAddress, Is.EqualTo(expectedDto.IpAddress));
            Assert.That(model.ApiKey, Is.EqualTo(expectedDto.ApiKey));
            Assert.That(model.Port, Is.EqualTo(expectedDto.Port));
            Assert.That(model.ShowOnDashboard, Is.EqualTo(expectedDto.ShowOnDashboard));
            Assert.That(model.Username, Is.EqualTo(expectedDto.Username));
            Assert.That(model.Password, Is.EqualTo(expectedDto.Password));
        }