Пример #1
0
        public void negative_test()
        {
            var log = new ActivationLog();

            var file = Guid.NewGuid().ToString() + ".txt";
            var requirement = new FileExists(file);

            requirement.Check(log);

            log.Success.ShouldBeFalse();
            log.FullTraceText().ShouldContain("File '{0}' does not exist!".ToFormat(file));
        }
Пример #2
0
        public void positive_test()
        {
            new FileSystem().WriteStringToFile("file.txt", "anything");

            var log = new ActivationLog();

            var requirement = new FileExists("file.txt");

            requirement.Check(log);

            log.Success.ShouldBeTrue();
            log.FullTraceText().ShouldContain("File 'file.txt' exists");
        }
Пример #3
0
        public void positive_test()
        {
            new FileSystem().CreateDirectory("foo");

            var log = new ActivationLog();

            var requirement = new FolderExists("foo");

            requirement.Check(log);

            log.Success.ShouldBeTrue();
            log.FullTraceText().ShouldContain("Folder 'foo' exists");
        }
Пример #4
0
		public void SaveActivationLog(Model.ActivationLog activationLog)
		{
			using (ScutexServiceEntities db1 = new ScutexServiceEntities())
			{
				ActivationLog al = new ActivationLog();
				al.LicenseKey = activationLog.LicenseKey;
				al.ActivationResult = (int)activationLog.ActivationResult;
				al.IPAddress = activationLog.IpAddress;
				al.Timestamp = activationLog.Timestamp;

				db1.AddToActivationLogs(al);
				db1.SaveChanges();
			}
		}
Пример #5
0
        public void positive_test_with_generic()
        {
            new FileSystem().WriteStringToFile("file.txt", "anything");
            var settings = new FileSettings
            {
                File = "file.txt"
            };

            var log = new ActivationLog();

            var requirement = new FileExists<FileSettings>(x => x.File, settings);

            requirement.Check(log);

            log.Success.ShouldBeTrue();
            log.FullTraceText().ShouldContain("File 'file.txt' defined by FileSettings.File exists");
        }
Пример #6
0
        public void negative_test_with_settings()
        {
            var log = new ActivationLog();

            var file = Guid.NewGuid().ToString() + ".txt";
            var settings = new FileSettings
            {
                File = file
            };

            var requirement = new FileExists<FileSettings>(x => x.File, settings);

            requirement.Check(log);

            log.Success.ShouldBeFalse();
            log.FullTraceText().ShouldContain("File '{0}' defined by FileSettings.File does not exist!".ToFormat(file));
        }
Пример #7
0
        public void positive_test_with_generic()
        {
            new FileSystem().CreateDirectory("foo");
            var settings = new FileSettings
            {
                Folder = "foo"
            };

            var log = new ActivationLog();

            var requirement = new FolderExists<FileSettings>(x => x.Folder, settings);

            requirement.Check(log);

            log.Success.ShouldBeTrue();
            log.FullTraceText().ShouldContain("Folder 'foo' defined by FileSettings.Folder exists");
        }