コード例 #1
0
        public void DeepClone_Works()
        {
            // Arrange
            var sut = new HealthCheckOptions
            {
                Enabled  = true,
                Interval = TimeSpan.FromSeconds(2),
                Timeout  = TimeSpan.FromSeconds(1),
                Port     = 123,
                Path     = "/a",
            };

            // Act
            var clone = sut.DeepClone();

            // Assert
            clone.Should().NotBeSameAs(sut);
            clone.Enabled.Should().Be(sut.Enabled);
            clone.Interval.Should().Be(sut.Interval);
            clone.Timeout.Should().Be(sut.Timeout);
            clone.Port.Should().Be(sut.Port);
            clone.Path.Should().Be(sut.Path);
        }
コード例 #2
0
        public void DeepClone_Works()
        {
            // Arrange
            var sut = new HealthCheckOptions
            {
                Enabled  = true,
                Interval = TimeSpan.FromSeconds(2),
                Timeout  = TimeSpan.FromSeconds(1),
                Port     = 123,
                Path     = "/a",
            };

            // Act
            var clone = sut.DeepClone();

            // Assert
            Assert.NotSame(sut, clone);
            Assert.Equal(sut.Enabled, clone.Enabled);
            Assert.Equal(sut.Interval, clone.Interval);
            Assert.Equal(sut.Timeout, clone.Timeout);
            Assert.Equal(sut.Port, clone.Port);
            Assert.Equal(sut.Path, clone.Path);
        }