public void CreateReferenceWithTemplateUpdateModelAndExecuteUpdate_Failing() { List <string> a = new List <string>(); List <object> e = new List <object>(); a.Add("UpdateLib.json"); a.Add("UpdateModelLib.WrongModel.json"); testArguments.Skip(2).ToList().ForEach(e => a.Add(e)); Update u = new Update(a); u.UpdateMessage += delegate(object o) { e.Add(o); }; BaseUpdateException ex = Assert.Throws <UpdateException>(() => u.ExecuteUpdate()); Assert.NotNull(u); Assert.Equal(ErrorCode.REFLECTION, ex.ErrorCode); Assert.Equal("PropertyName <Model:wrong> not found!", ex.Message); Assert.Equal("PropertyName <Model:wrong> not found!", ex.ErrorMessage()); Assert.Equal(UpdateResource.LoadModel, e.ElementAt(0)); }
public void CreateReferenceWithTemplateUpdateModel_Failing(string updateConfig, string modelConfig, ErrorCode errorCode, string message, string errorMessage) { Update u = null; List <string> failArguments = new List <string>(); failArguments.Add(updateConfig); failArguments.Add(modelConfig); testArguments.Skip(2).ToList().ForEach(e => failArguments.Add(e)); BaseUpdateException ex = Assert.Throws <UpdateException>(() => u = new Update(failArguments)); Assert.Null(u); Assert.Equal(errorCode, ex.ErrorCode); Assert.Equal(message, ex.Message); Assert.Equal(errorMessage, ex.ErrorMessage()); }