Esempio n. 1
0
        public void ReturnsDataWithoutFakeRegistry()
        {
            // Arrange
            var sut = new SetWindowsReleaseVersionEnvironmentVariable()
            {
                BuildEngine = new FakeBuildEngine()
            };

            // Act
            bool result = sut.Execute();

            // Assert
            Assert.True(result);
            Assert.True(sut.Output.Length > 0);
        }
Esempio n. 2
0
        [InlineData("25H2", 05, 11111, "25H2")]     // fake major version
        public void ReturnsCorrectVersions(string releaseId, int major, int buildNumber, string expected)
        {
            // Arrange
            var registryMock = new Mock <IRegistry>();

            registryMock.Setup(x => x.Read(It.IsAny <string>(), It.IsAny <string>())).Returns(releaseId);

            var versionMock = new Mock <IVersion>();

            versionMock.Setup(x => x.GetOsVersion()).Returns(new System.Version(major, 0, buildNumber));


            var sut = new SetWindowsReleaseVersionEnvironmentVariable(registryMock.Object, versionMock.Object)
            {
                BuildEngine = new FakeBuildEngine()
            };

            // Act
            bool result = sut.Execute();

            // Assert
            Assert.True(result);
            Assert.Equal(expected, sut.Output);
        }