コード例 #1
0
        public void ComparesVersionNumbers(string version1, string @operator, string version2, bool result)
        {
            // Arrange
            var t = new CompareVersion();

            t.BuildEngine = new MockEngine();

            t.Version1 = version1;
            t.Operator = @operator;
            t.Version2 = version2;

            // Act
            var success = t.Execute();

            // Assert
            Assert.True(success);
            Assert.Equal(t.Result, result);
        }
コード例 #2
0
        public void Version2IsInvalid_Fails()
        {
            // Arrange
            var t      = new CompareVersion();
            var engine = new MockEngine();

            t.BuildEngine = engine;

            t.Version1 = "2.7.1.0";
            t.Operator = "NotEqual";
            t.Version2 = "NotARealVersion";

            // Act
            var success = t.Execute();

            // Assert
            Assert.False(success);
            Assert.Equal(1, engine.ErrorEvents.Count);
        }