Exemple #1
0
        public void can_store_metadata_with_upload()
        {
            var meta = new AppMeta()
            {
                User        = "******",
                LastAccess  = DateTime.Now,
                Roles       = new[] { "admin", "office" },
                ContentType = "application/pdf"
            };

            var opts = new UploadOptions();

            opts.SetMetadata(meta);

            var id = bucket.Upload(testfile, TestBytes.HalfChunk, opts);

            var fileInfo = bucket.GetFileInfo(id);

            fileInfo.Metadata.Should().NotBeNull();

            var otherMeta = fileInfo.Metadata.ToObject <AppMeta>(Converter.Serializer);

            otherMeta.User.Should().Be(meta.User);
            otherMeta.LastAccess.Should().BeCloseTo(meta.LastAccess.Value, 2000);
            otherMeta.Roles.Should().Equal(meta.Roles);
            otherMeta.ContentType.Should().Be(meta.ContentType);
        }
Exemple #2
0
 public static void Execute(AppMeta app)
 {
     try
     {
         ProcessStartInfo startInfo = new ProcessStartInfo(app.Shortcut.ExePath);
         startInfo.Arguments       = app.Shortcut.Arguments;
         startInfo.UseShellExecute = true;
         Process process = new Process();
         process.StartInfo = startInfo;
         process.Start();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
        public void can_store_metadata_with_upload()
        {
            var meta = new AppMeta()
                {
                    User = "******",
                    LastAccess = DateTime.Now,
                    Roles = new[] {"admin", "office"},
                    ContentType = "application/pdf"
                };

            var opts = new UploadOptions();
            opts.SetMetadata(meta);

            var id = bucket.Upload(testfile, TestBytes.HalfChunk, opts);

            var fileInfo = bucket.GetFileInfo(id);
            fileInfo.Metadata.Should().NotBeNull();

            var otherMeta = fileInfo.Metadata.ToObject<AppMeta>(Converter.Serializer);

            otherMeta.User.Should().Be(meta.User);
            otherMeta.LastAccess.Should().BeCloseTo(meta.LastAccess.Value, 2000);
            otherMeta.Roles.Should().Equal(meta.Roles);
            otherMeta.ContentType.Should().Be(meta.ContentType);
        }