Exemplo n.º 1
0
        public void SetUp()
        {
            var mockRepo = new Mock <ISettingsRepository>();

            logger       = new Mock <ILogger>();
            ExpectedLink = new GlobalSettings
            {
                Id           = 1,
                Content      = "oDuq+yWcOzb7qgRvmyljVAS6dLdT1fydgeyMuObYkYJwzTNTXlwC4+V/Tp0O6FZuKfKbDuaonSXMzg8ndZhM118am2HiobAd37KrCFcb7X594TmzrHUFCuqflHPOl3FsZnKnZXqsvABt6QCnFZLb3eG6smE/uqQ5QVohtt2qzi8ZrGifb5pjXJIfSDwnXGj951zKfxQ7Wq84QmAUU5eqPdDBq2ODsLnRfVamrieVPIxzhhaFFKLJF9QvAE8SPm4i",
                SettingsName = "PageName",
            };

            F = new Fixture();
            ExpectedGetLinks = F.CreateMany <GlobalSettings>().ToList();


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

            mockRepo.Setup(x => x.Get(It.IsAny <string>())).Returns(ExpectedLink).Verifiable();

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

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

            mockRepo.Setup(x => x.Delete(It.IsAny <GlobalSettings>())).Returns(true).Verifiable();


            MockRepo = mockRepo;
            Service  = new SettingsService <NzbDashSettings, Setting>(MockRepo.Object, logger.Object);
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            var mockRepo = new Mock <ISettingsRepository>();

            logger       = new Mock <ILogger>();
            ExpectedLink = new GlobalSettings
            {
                Id           = 1,
                Content      = "{\"$type\":\"NZBDash.DataAccessLayer.Models.Settings.NzbDashSettings,NZBDash.DataAccessLayer.Models\",\"Authenticate\":true,\"Id\":6}",
                SettingsName = "Test",
            };

            F = new Fixture();
            ExpectedGetLinks = F.CreateMany <GlobalSettings>().ToList();


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

            mockRepo.Setup(x => x.Get(It.IsAny <string>())).Returns(ExpectedLink).Verifiable();

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

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


            MockRepo = mockRepo;
            Service  = new SettingsService <NzbDashSettings, Setting>(MockRepo.Object, logger.Object);
        }
Exemplo n.º 3
0
 public bool Delete(GlobalSettings entity)
 {
     ResetCache();
     using (var con = Db.DbConnection())
     {
         return con.Delete(entity);
     }
 }
Exemplo n.º 4
0
        public void SetUp()
        {
            var mockRepo = new Mock<ISettingsRepository>();
            logger = new Mock<ILogger>();
            ExpectedLink = new GlobalSettings
            {
                Id = 1,
                Content = "oDuq+yWcOzb7qgRvmyljVAS6dLdT1fydgeyMuObYkYJwzTNTXlwC4+V/Tp0O6FZuKfKbDuaonSXMzg8ndZhM118am2HiobAd37KrCFcb7X594TmzrHUFCuqflHPOl3FsZnKnZXqsvABt6QCnFZLb3eG6smE/uqQ5QVohtt2qzi8ZrGifb5pjXJIfSDwnXGj951zKfxQ7Wq84QmAUU5eqPdDBq2ODsLnRfVamrieVPIxzhhaFFKLJF9QvAE8SPm4i",
                SettingsName = "PageName",
            };

            F = new Fixture();
            ExpectedGetLinks = F.CreateMany<GlobalSettings>().ToList();

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

            mockRepo.Setup(x => x.Get(It.IsAny<string>())).Returns(ExpectedLink).Verifiable();

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

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

            mockRepo.Setup(x => x.Delete(It.IsAny<GlobalSettings>())).Returns(true).Verifiable();

            MockRepo = mockRepo;
            Service = new SettingsService<NzbDashSettings, Setting>(MockRepo.Object, logger.Object);
        }
Exemplo n.º 5
0
 public long Insert(GlobalSettings entity)
 {
     ResetCache();
     using (var con = Db.DbConnection())
     {
         return con.Insert(entity);
     }
 }