public void Equals_Negative() { var a = new RouteHeader() { Name = "foo", Mode = HeaderMatchMode.Exists, Values = new[] { "v1", "v2" }, IsCaseSensitive = true, }; var b = a with { Name = "bar" }; var c = a with { Mode = HeaderMatchMode.ExactHeader }; var d = a with { Values = new[] { "v1", "v3" } }; var e = a with { IsCaseSensitive = false }; Assert.False(a.Equals(b)); Assert.False(a.Equals(c)); Assert.False(a.Equals(d)); Assert.False(a.Equals(e)); }
public void DeepClone_Nulls_Works() { var sut = new RouteHeader(); var clone = sut.DeepClone(); Assert.NotSame(sut, clone); Assert.Null(clone.Name); Assert.Null(clone.Values); Assert.Equal(HeaderMatchMode.ExactHeader, clone.Mode); Assert.False(clone.IsCaseSensitive); Assert.True(RouteHeader.Equals(sut, clone)); }
public void Equals_Positive() { var a = new RouteHeader() { Name = "foo", Mode = HeaderMatchMode.Exists, Values = new[] { "v1", "v2" }, IsCaseSensitive = true, }; var b = new RouteHeader() { Name = "foo", Mode = HeaderMatchMode.Exists, Values = new[] { "v1", "v2" }, IsCaseSensitive = true, }; var c = a with { }; // Clone Assert.True(a.Equals(b)); Assert.True(a.Equals(c)); }
public void DeepClone_Works() { var sut = new RouteHeader { Name = "header1", Values = new[] { "value1", "value2" }, Mode = HeaderMatchMode.HeaderPrefix, IsCaseSensitive = true, }; var clone = sut.DeepClone(); Assert.NotSame(sut, clone); Assert.Equal(sut.Name, clone.Name); Assert.NotSame(sut.Values, clone.Values); Assert.Equal(sut.Values, clone.Values); Assert.Equal(sut.Mode, clone.Mode); Assert.Equal(sut.IsCaseSensitive, clone.IsCaseSensitive); Assert.True(RouteHeader.Equals(sut, clone)); }