public void GetConfigurationWrongIdFail()
        {
            var manager = new ConfigurationManager(UnitTestHelper.FakeRepository.Object,
                UnitTestHelper.FakeAuditor.Object);

            var configuration = manager.GetConfiguration(Guid.NewGuid(), It.IsAny<string>());
            Assert.IsNull(configuration, $"Expected null configuration, found {configuration}");
        }
        public void GetConfigurationsCorrectUserPass()
        {
            var manager = new ConfigurationManager(UnitTestHelper.FakeRepository.Object,
                UnitTestHelper.FakeAuditor.Object);

            var configurations = manager.GetConfigurations(FakeRepository.UserName);
            var count = configurations.Count();
            Assert.True(count == 1, $"Expected 1 configurations, found {count}");
        }
        public void GetConfigurationsNullUserFail()
        {
            var manager = new ConfigurationManager(UnitTestHelper.FakeRepository.Object,
                UnitTestHelper.FakeAuditor.Object);

            var configurations = manager.GetConfigurations(null);
            var count = configurations.Count();
            Assert.True(count == 0, $"Expected 0 configurations, found {count}");
        }
        public void GetConfigurationCorrectIdPass()
        {
            var manager = new ConfigurationManager(UnitTestHelper.FakeRepository.Object,
                UnitTestHelper.FakeAuditor.Object);

            var configuration = manager.GetConfiguration(FakeRepository.ConfigurationId, It.IsAny<string>());
            Assert.IsNotNull(configuration, "Expected valid configuration, found null");
            Assert.AreEqual(FakeRepository.ConfigurationId, configuration.Id, "Expected configuration Id not found");
            Assert.AreEqual(FakeRepository.UserName, configuration.Author, "Expected configuration name not found");
        }
        public void SaveConfiguration()
        {
            UnitTestHelper.FakeRepository.ResetCalls();

            var manager = new ConfigurationManager(UnitTestHelper.FakeRepository.Object,
                UnitTestHelper.FakeAuditor.Object);

            manager.SaveConfiguration(FakeRepository.Database.First(), FakeRepository.UserName);

            UnitTestHelper.FakeRepository.Verify(
                mock => mock.Save(FakeRepository.ConfigurationId, It.IsAny<int>(), It.IsAny<string>(), 
                It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), 
                Times.Exactly(1));
        }
        public void DeleteConfiguration()
        {
            UnitTestHelper.FakeRepository.ResetCalls();

            var manager = new ConfigurationManager(UnitTestHelper.FakeRepository.Object,
                UnitTestHelper.FakeAuditor.Object);

            manager.DeleteConfiguration(FakeRepository.ConfigurationId, FakeRepository.UserName);

            UnitTestHelper.FakeRepository.Verify(
                mock => mock.DeleteConfiguration(FakeRepository.ConfigurationId),Times.Once);
        }