Beispiel #1
0
        public void Load_Empty()
        {
            IO.Copy(GetSource("SettingsEmpty.json"), LocalSettingPath(), true);
            IO.Copy(GetSource("SettingsEmpty.json"), SharedSettingPath(), true);
            var asm = Assembly.GetExecutingAssembly();
            var src = new SettingFolder(asm, RootDirectory(), IO);

            Assert.That(src.TryLoad(), Is.True);
            Assert.That(src.Value.Width, Is.EqualTo(1100));
            Assert.That(src.Value.Height, Is.EqualTo(650));
            Assert.That(src.Value.DataDirectory, Is.EqualTo(RootDirectory()));
            Assert.That(src.Shared.StartUri, Is.Null);
            Assert.That(src.Shared.Capacity, Is.EqualTo(100));
            Assert.That(src.Shared.EnableNewWindow, Is.False);
            Assert.That(src.Shared.EnableMonitorMessage, Is.True);
            Assert.That(src.Shared.LightMode, Is.False);
            Assert.That(src.Shared.CheckUpdate, Is.True);
            Assert.That(src.Shared.HighInterval.Value, Is.EqualTo(TimeSpan.FromHours(1)));
            Assert.That(src.Shared.LowInterval.Value, Is.EqualTo(TimeSpan.FromDays(1)));
            Assert.That(src.Shared.InitialDelay.Value, Is.EqualTo(TimeSpan.FromSeconds(3)));
            Assert.That(src.Lock.IsReadOnly, Is.False);
            Assert.That(src.Lock.IsReadOnly, Is.False);
            Assert.That(src.Lock.UserName, Is.EqualTo(Environment.UserName));
            Assert.That(src.Lock.MachineName, Is.EqualTo(Environment.MachineName));
            Assert.That(src.Lock.Sid, Does.StartWith("S-1-5-21"));
        }
Beispiel #2
0
        public void Load()
        {
            Copy();
            var asm = Assembly.GetExecutingAssembly();
            var src = new SettingFolder(asm, RootDirectory(), IO);

            Assert.That(src.TryLoad(), Is.True);
            Assert.That(src.Value.Width, Is.EqualTo(1100));
            Assert.That(src.Value.Height, Is.EqualTo(650));
            Assert.That(src.Value.DataDirectory, Is.EqualTo(RootDirectory()));
            Assert.That(src.Shared.StartUri, Is.EqualTo(new Uri("https://github.com/blog.atom")));
            Assert.That(src.Shared.Capacity, Is.EqualTo(5));
            Assert.That(src.Shared.EnableNewWindow, Is.True);
            Assert.That(src.Shared.EnableMonitorMessage, Is.True);
            Assert.That(src.Shared.LightMode, Is.False);
            Assert.That(src.Shared.CheckUpdate, Is.True);
            Assert.That(src.Shared.HighInterval.Value, Is.EqualTo(TimeSpan.FromHours(1)));
            Assert.That(src.Shared.LowInterval.Value, Is.EqualTo(TimeSpan.FromDays(1)));
            Assert.That(src.Shared.InitialDelay.Value, Is.EqualTo(TimeSpan.FromSeconds(3)));
            Assert.That(src.Lock.IsReadOnly, Is.False);
            Assert.That(src.Lock.IsReadOnly, Is.False);
            Assert.That(src.Lock.UserName, Is.EqualTo(Environment.UserName));
            Assert.That(src.Lock.MachineName, Is.EqualTo(Environment.MachineName));
            Assert.That(src.Lock.Sid, Does.StartWith("S-1-5-21"));
        }
Beispiel #3
0
        public void Load_NotFound()
        {
            var asm = Assembly.GetExecutingAssembly();
            var src = new SettingFolder(asm, RootDirectory(), IO);

            Assert.That(src.TryLoad(), Is.False);
            Assert.That(src.DataDirectory, Is.EqualTo(RootDirectory()));
            Assert.That(src.Value, Is.Not.Null, nameof(src.Value));
            Assert.That(src.Shared, Is.Not.Null, nameof(src.Shared));
            Assert.That(src.Lock, Is.Not.Null, nameof(src.Lock));
        }
Beispiel #4
0
        public void Load_Invalid()
        {
            IO.Copy(GetSource("Dummy.txt"), LocalSettingPath(), true);
            IO.Copy(GetSource("Dummy.txt"), SharedSettingPath(), true);
            var asm = Assembly.GetExecutingAssembly();
            var src = new SettingFolder(asm, RootDirectory(), IO);

            Assert.That(src.TryLoad(), Is.False);
            Assert.That(src.DataDirectory, Is.EqualTo(RootDirectory()));
            Assert.That(src.Value, Is.Not.Null, nameof(src.Value));
            Assert.That(src.Shared, Is.Not.Null, nameof(src.Shared));
            Assert.That(src.Lock, Is.Not.Null, nameof(src.Lock));
        }