Ejemplo n.º 1
0
        public virtual void TestTimelinePutErrors()
        {
            TimelinePutResponse TimelinePutErrors = new TimelinePutResponse();

            TimelinePutResponse.TimelinePutError error1 = new TimelinePutResponse.TimelinePutError
                                                              ();
            error1.SetEntityId("entity id 1");
            error1.SetEntityId("entity type 1");
            error1.SetErrorCode(TimelinePutResponse.TimelinePutError.NoStartTime);
            TimelinePutErrors.AddError(error1);
            IList <TimelinePutResponse.TimelinePutError> response = new AList <TimelinePutResponse.TimelinePutError
                                                                               >();

            response.AddItem(error1);
            TimelinePutResponse.TimelinePutError error2 = new TimelinePutResponse.TimelinePutError
                                                              ();
            error2.SetEntityId("entity id 2");
            error2.SetEntityId("entity type 2");
            error2.SetErrorCode(TimelinePutResponse.TimelinePutError.IoException);
            response.AddItem(error2);
            TimelinePutErrors.AddErrors(response);
            Log.Info("Errors in JSON:");
            Log.Info(TimelineUtils.DumpTimelineRecordtoJSON(TimelinePutErrors, true));
            NUnit.Framework.Assert.AreEqual(3, TimelinePutErrors.GetErrors().Count);
            TimelinePutResponse.TimelinePutError e = TimelinePutErrors.GetErrors()[0];
            NUnit.Framework.Assert.AreEqual(error1.GetEntityId(), e.GetEntityId());
            NUnit.Framework.Assert.AreEqual(error1.GetEntityType(), e.GetEntityType());
            NUnit.Framework.Assert.AreEqual(error1.GetErrorCode(), e.GetErrorCode());
            e = TimelinePutErrors.GetErrors()[1];
            NUnit.Framework.Assert.AreEqual(error1.GetEntityId(), e.GetEntityId());
            NUnit.Framework.Assert.AreEqual(error1.GetEntityType(), e.GetEntityType());
            NUnit.Framework.Assert.AreEqual(error1.GetErrorCode(), e.GetErrorCode());
            e = TimelinePutErrors.GetErrors()[2];
            NUnit.Framework.Assert.AreEqual(error2.GetEntityId(), e.GetEntityId());
            NUnit.Framework.Assert.AreEqual(error2.GetEntityType(), e.GetEntityType());
            NUnit.Framework.Assert.AreEqual(error2.GetErrorCode(), e.GetErrorCode());
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Add a single
 /// <see cref="TimelinePutError"/>
 /// instance into the existing list
 /// </summary>
 /// <param name="error">
 /// a single
 /// <see cref="TimelinePutError"/>
 /// instance
 /// </param>
 public virtual void AddError(TimelinePutResponse.TimelinePutError error)
 {
     errors.AddItem(error);
 }