Exemplo n.º 1
0
    public void InvalidAttribute()
    {
      var cmd = new Cmd.SetAttribute();
      InitCommand(cmd);

      _context.CurrentItem = _testRoot;
      cmd.Attribute = "bler";
      cmd.Value = "hello";
      
      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Failure));
    }
Exemplo n.º 2
0
    public void SetName()
    {
      var salt = DateUtil.IsoNow;
      var name = "nameitem" + salt;
      var item = _testRoot.Add(name, _context.CurrentDatabase.Templates[Constants.Paths.DocTemplate]);

      var cmd = new Cmd.SetAttribute();
      InitCommand(cmd);

      _context.CurrentItem = item;
      cmd.Attribute = "name";
      cmd.Value = "updated " + name;

      var result = cmd.Run();
      item.Reload();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));
      Assert.That(result.Message, Is.StringContaining("name"));
      Assert.That(result.Message, Is.StringContaining("updated " + name));
      Assert.That(item.Name, Is.EqualTo("updated " + name));
    }
Exemplo n.º 3
0
    public void NoParameters()
    {
      var cmd = new Cmd.SetAttribute();
      InitCommand(cmd);

      _context.CurrentItem = _testRoot;
      
      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Failure));
    }
Exemplo n.º 4
0
    public void SetTemplateByID()
    {
      var salt = DateUtil.IsoNow;
      var name = "templateitem" + salt;
      var item = _testRoot.Add(name, _context.CurrentDatabase.Templates[Constants.Paths.DocTemplate]);

      var cmd = new Cmd.SetAttribute();
      InitCommand(cmd);

      _context.CurrentItem = item;
      cmd.Attribute = "template";
      cmd.Value = "{A87A00B1-E6DB-45AB-8B54-636FEC3B5523}";
      
      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));
      Assert.That(result.Message, Is.StringContaining("templateid"));
      Assert.That(result.Message, Is.StringContaining("{A87A00B1-E6DB-45AB-8B54-636FEC3B5523}"));
      Assert.That(_context.CurrentItem.Template.Name, Is.EqualTo("Folder"));
    }