public void Ctor_Adds_IETF_Error_Urn() { var type = "test"; var detail = "detail"; var sut = new Model.AcmeError(type, detail); Assert.Equal("urn:ietf:params:acme:error:test", sut.Type); }
public void Ctor_Initializes_Type_And_Detail() { var acmeError = new Model.AcmeError("type", "detail"); var sut = new HttpModel.AcmeError(acmeError); Assert.Equal(acmeError.Type, sut.Type); Assert.Equal(acmeError.Detail, sut.Detail); Assert.Null(sut.Identifier); Assert.Null(sut.Subproblems); }
public void Ctor_Populates_All_Properties() { var type = "custom:error"; var detail = "detail"; var identifier = new Model.Identifier("dns", "www.example.com"); var sut = new Model.AcmeError(type, detail, identifier); Assert.Equal(type, sut.Type); Assert.Equal(detail, sut.Detail); Assert.Equal(identifier, sut.Identifier); }
public void Ctor_Intializes_All_Properties() { var acmeError = new Model.AcmeError("type", "detail", new Model.Identifier("dns", "www.example.com"), new List <Model.AcmeError> { new Model.AcmeError("innerType", "innerDetail") }); var sut = new HttpModel.AcmeError(acmeError); Assert.Equal(acmeError.Type, sut.Type); Assert.Equal(acmeError.Detail, sut.Detail); Assert.NotNull(sut.Identifier); Assert.NotNull(sut.Subproblems); Assert.Single(sut.Subproblems); }
public AcmeError(Model.AcmeError model) { if (model is null) { throw new System.ArgumentNullException(nameof(model)); } Type = model.Type; Detail = model.Detail; if (model.Identifier != null) { Identifier = new Identifier(model.Identifier); } Subproblems = model.SubErrors? .Select(x => new AcmeError(x)) .ToList(); }