示例#1
0
        public void ServerSecurityService_Constructor_FileSystemWatcher_CreatedEventWiredUp()
        {
            //------------Setup for test--------------------------
            var fileName = string.Format("secure_{0}.config", Guid.NewGuid());

            var serverSecurityService = new TestServerSecurityService(fileName);

            //------------Execute Test---------------------------
            File.WriteAllText(fileName, @"xxx");
            WaitForEvents();

            //------------Assert Results-------------------------
            Assert.IsTrue(serverSecurityService.OnFileChangedHitCount > 0);

            serverSecurityService.Dispose();
        }
        public void ServerSecurityService_Constructor_FileSystemWatcher_CreatedEventWiredUp()
        {
            //------------Setup for test--------------------------
            var fileName = string.Format("secure_{0}.config", Guid.NewGuid());

            var serverSecurityService = new TestServerSecurityService(fileName);

            //------------Execute Test---------------------------
            File.WriteAllText(fileName, @"xxx");
            WaitForEvents();

            //------------Assert Results-------------------------
            Assert.IsTrue(serverSecurityService.OnFileChangedHitCount > 0);

            serverSecurityService.Dispose();
        }
示例#3
0
        public void ServerSecurityService_Constructor_FileSystemWatcher_RenamedEventWiredUp()
        {
            //------------Setup for test--------------------------
            var fileName1 = string.Format("secure_{0}.config", Guid.NewGuid());
            var fileName2 = string.Format("secure_{0}.config", Guid.NewGuid());

            File.WriteAllText(fileName1, @"xxx");

            var serverSecurityService = new TestServerSecurityService(fileName1);

            //------------Execute Test---------------------------
            File.Move(fileName1, fileName2);
            WaitForEvents();

            //------------Assert Results-------------------------
            Assert.AreEqual(1, serverSecurityService.OnFileRenamedHitCount);

            serverSecurityService.Dispose();
        }
        public void ServerSecurityService_OnFileChanged_RaisingEvents_DisabledAndEnabled()
        {
            //------------Setup for test--------------------------
            var fileName = string.Format("secure_{0}.config", Guid.NewGuid());
            File.WriteAllText(fileName, @"xxx");

            var serverSecurityService = new TestServerSecurityService(fileName);

            //------------Execute Test---------------------------
            File.WriteAllText(fileName, @"ssss");
            ServerSecurityServiceTests.WaitForEvents();

            //------------Assert Results-------------------------
            Assert.AreEqual(2, serverSecurityService.OnFileChangedEnableRaisingEventsEnabled.Count);
            Assert.IsFalse(serverSecurityService.OnFileChangedEnableRaisingEventsEnabled[0]);
            Assert.IsTrue(serverSecurityService.OnFileChangedEnableRaisingEventsEnabled[1]);

            serverSecurityService.Dispose();
        }
示例#5
0
        public void ServerSecurityService_OnFileChanged_RaisingEvents_DisabledAndEnabled()
        {
            //------------Setup for test--------------------------
            var fileName = string.Format("secure_{0}.config", Guid.NewGuid());

            File.WriteAllText(fileName, @"xxx");

            var serverSecurityService = new TestServerSecurityService(fileName);

            //------------Execute Test---------------------------
            File.WriteAllText(fileName, @"ssss");
            WaitForEvents();

            //------------Assert Results-------------------------
            Assert.AreEqual(2, serverSecurityService.OnFileChangedEnableRaisingEventsEnabled.Count);
            Assert.IsFalse(serverSecurityService.OnFileChangedEnableRaisingEventsEnabled[0]);
            Assert.IsTrue(serverSecurityService.OnFileChangedEnableRaisingEventsEnabled[1]);

            serverSecurityService.Dispose();
        }
        public void ServerSecurityService_Constructor_FileSystemWatcher_RenamedEventWiredUp()
        {
            //------------Setup for test--------------------------
            var fileName1 = string.Format("secure_{0}.config", Guid.NewGuid());
            var fileName2 = string.Format("secure_{0}.config", Guid.NewGuid());
            File.WriteAllText(fileName1, @"xxx");

            var serverSecurityService = new TestServerSecurityService(fileName1);

            //------------Execute Test---------------------------
            File.Move(fileName1, fileName2);
            WaitForEvents();

            //------------Assert Results-------------------------
            Assert.AreEqual(1, serverSecurityService.OnFileRenamedHitCount);

            serverSecurityService.Dispose();
        }