Exemplo n.º 1
0
        public void TestEquals()
        {
            DateTime deploymentStartTime = DateTime.UtcNow;
            var      release1            = new IoTEdgeRelease(
                123213,
                ReleaseDefinitionId.E2ETest,
                "test-release",
                "branch1",
                VstsReleaseStatus.Active,
                new Uri("http://abc.com/test/uri"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, "Any name", VstsEnvironmentStatus.NotStarted, new HashSet <IoTEdgeReleaseDeployment>()),
                new IoTEdgeReleaseEnvironment(784, 23903, "Any name", VstsEnvironmentStatus.InProgress, new HashSet <IoTEdgeReleaseDeployment>())
            });

            var release2 = new IoTEdgeRelease(
                123213,
                ReleaseDefinitionId.E2ETest,
                "test-release",
                "branch1",
                VstsReleaseStatus.Active,
                new Uri("http://abc.com/test/uri"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, "Any name", VstsEnvironmentStatus.NotStarted, new HashSet <IoTEdgeReleaseDeployment>()),
                new IoTEdgeReleaseEnvironment(784, 23903, "Any name", VstsEnvironmentStatus.InProgress, new HashSet <IoTEdgeReleaseDeployment>())
            });

            var release3 = new IoTEdgeRelease(
                2343,
                ReleaseDefinitionId.E2ETest,
                "test-release",
                "branch1",
                VstsReleaseStatus.Active,
                new Uri("http://abc.com/test/uri"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, "Any name", VstsEnvironmentStatus.NotStarted, new HashSet <IoTEdgeReleaseDeployment>()),
                new IoTEdgeReleaseEnvironment(784, 23903, "Any name", VstsEnvironmentStatus.InProgress, new HashSet <IoTEdgeReleaseDeployment>())
            });

            var release4 = new IoTEdgeRelease(
                123213,
                ReleaseDefinitionId.E2ETest,
                "test-release",
                "branch1",
                VstsReleaseStatus.Active,
                new Uri("http://abc.com/test/uri"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, "Any name", VstsEnvironmentStatus.NotStarted, new HashSet <IoTEdgeReleaseDeployment>()),
                new IoTEdgeReleaseEnvironment(784, 23903, "Any name", VstsEnvironmentStatus.InProgress, new HashSet <IoTEdgeReleaseDeployment>())
            });

            var release5 = new IoTEdgeRelease(
                123213,
                ReleaseDefinitionId.E2ETest,
                "test-release342",
                "branch1",
                VstsReleaseStatus.Active,
                new Uri("http://abc.com/test/uri"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, "Any name", VstsEnvironmentStatus.NotStarted, new HashSet <IoTEdgeReleaseDeployment>()),
                new IoTEdgeReleaseEnvironment(784, 23903, "Any name", VstsEnvironmentStatus.InProgress, new HashSet <IoTEdgeReleaseDeployment>())
            });

            var release6 = new IoTEdgeRelease(
                123213,
                ReleaseDefinitionId.E2ETest,
                "test-release",
                "branch1",
                VstsReleaseStatus.Active,
                new Uri("http://abc.com/test/uri/123123"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, "Any name", VstsEnvironmentStatus.NotStarted, new HashSet <IoTEdgeReleaseDeployment>()),
                new IoTEdgeReleaseEnvironment(784, 23903, "Any name", VstsEnvironmentStatus.InProgress, new HashSet <IoTEdgeReleaseDeployment>())
            });

            var release7 = new IoTEdgeRelease(
                123213,
                ReleaseDefinitionId.E2ETest,
                "test-release",
                "branch1",
                VstsReleaseStatus.Active,
                new Uri("http://abc.com/test/uri/123123"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, "Any name", VstsEnvironmentStatus.NotStarted, new HashSet <IoTEdgeReleaseDeployment>())
            });

            Assert.False(release1.Equals(null));
            Assert.True(release1.Equals(release1));
            Assert.True(release1.Equals(release2));

            Assert.False(release1.Equals((object)null));
            Assert.True(release1.Equals((object)release1));
            Assert.True(release1.Equals((object)release2));
            Assert.False(release1.Equals(new object()));

            Assert.False(release1.Equals(release3));
            Assert.True(release1.Equals(release4));
            Assert.False(release1.Equals(release5));
            Assert.False(release1.Equals(release6));
            Assert.False(release1.Equals(release7));
        }
Exemplo n.º 2
0
        public void TestEquals()
        {
            var release1 = new IoTEdgeRelease(
                123213,
                343406,
                "test-release",
                new Uri("http://abc.com/test/uri"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, VstsEnvironmentStatus.NotStarted),
                new IoTEdgeReleaseEnvironment(784, 23903, VstsEnvironmentStatus.InProgress)
            });

            var release2 = new IoTEdgeRelease(
                123213,
                343406,
                "test-release",
                new Uri("http://abc.com/test/uri"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, VstsEnvironmentStatus.NotStarted),
                new IoTEdgeReleaseEnvironment(784, 23903, VstsEnvironmentStatus.InProgress)
            });

            var release3 = new IoTEdgeRelease(
                2343,
                343406,
                "test-release",
                new Uri("http://abc.com/test/uri"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, VstsEnvironmentStatus.NotStarted),
                new IoTEdgeReleaseEnvironment(784, 23903, VstsEnvironmentStatus.InProgress)
            });

            var release4 = new IoTEdgeRelease(
                123213,
                788,
                "test-release",
                new Uri("http://abc.com/test/uri"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, VstsEnvironmentStatus.NotStarted),
                new IoTEdgeReleaseEnvironment(784, 23903, VstsEnvironmentStatus.InProgress)
            });

            var release5 = new IoTEdgeRelease(
                123213,
                343406,
                "test-release342",
                new Uri("http://abc.com/test/uri"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, VstsEnvironmentStatus.NotStarted),
                new IoTEdgeReleaseEnvironment(784, 23903, VstsEnvironmentStatus.InProgress)
            });

            var release6 = new IoTEdgeRelease(
                123213,
                343406,
                "test-release",
                new Uri("http://abc.com/test/uri/123123"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, VstsEnvironmentStatus.NotStarted),
                new IoTEdgeReleaseEnvironment(784, 23903, VstsEnvironmentStatus.InProgress)
            });

            var release7 = new IoTEdgeRelease(
                123213,
                343406,
                "test-release",
                new Uri("http://abc.com/test/uri/123123"),
                new HashSet <IoTEdgeReleaseEnvironment>
            {
                new IoTEdgeReleaseEnvironment(3423, 8790, VstsEnvironmentStatus.NotStarted)
            });

            Assert.False(release1.Equals(null));
            Assert.True(release1.Equals(release1));
            Assert.True(release1.Equals(release2));

            Assert.False(release1.Equals((object)null));
            Assert.True(release1.Equals((object)release1));
            Assert.True(release1.Equals((object)release2));
            Assert.False(release1.Equals(new object()));

            Assert.False(release1.Equals(release3));
            Assert.False(release1.Equals(release4));
            Assert.False(release1.Equals(release5));
            Assert.False(release1.Equals(release6));
            Assert.False(release1.Equals(release7));
        }