public async Task Serialize_WithErrorsAsync() { var command = new MockCommand(this.user, MockPayload.Instance); var result1 = command.CreateResult(); result1.Errors = new List <CommandError> { await CreateFlurlHttpExceptionAsync().ConfigureAwait(false), new NotSupportedException() }; var json1 = TeamCloudSerialize.SerializeObject(result1); Assert.NotEmpty(json1); Assert.Contains("$type", json1); var result2 = TeamCloudSerialize.DeserializeObject <ICommandResult>(json1); var json2 = TeamCloudSerialize.SerializeObject(result2); Assert.NotEmpty(json2); Assert.Contains("$type", json2); Assert.Equal(json1, json2); }
public void Serialize() { var command = new MockCommand(this.user, MockPayload.Instance); var result = command.CreateResult(); var json = TeamCloudSerialize.SerializeObject(result); Assert.NotEmpty(json); Assert.Contains("$type", json); var resultObj = TeamCloudSerialize.DeserializeObject <ICommandResult>(json); Assert.IsType <MockCommandResult>(resultObj); }