PageModel.Update C# (CSharp) Method

Update() public method

public Update ( dynamic, item ) : PageModel,
item dynamic,
return PageModel,
    public PageModel Update(dynamic item)
    {
        Assert.IsTrue(item != null);
        Value = item;
        Validate();
        if (!HasError) Repository.Save(Value.Id as string, Value);
        return this;
    }

Usage Example

コード例 #1
0
ファイル: PageModelTest.cs プロジェクト: kouweizhong/Rabbit
    public void Update_Should_Validate_Title()
    {
        dynamic data = new ExpandoObject();

        data.Id    = "id";
        data.Title = null; // <-- it should catch this
        var repository = new Mock();
        var model      = new PageModel();

        model.Repository = repository;
        model.Update(data);
        Assert.IsTrue(model.HasError);
    }
All Usage Examples Of PageModel::Update