public void EnsureBasicReadingInRegistryWithDisplayVersion(string expectedReleaseId, string expectedUbr, string expectedDisplayVersion)
        {
            // arrange
            List <RegistryKeyNameReturnValue> registryKeyNameReturnValues = new List <RegistryKeyNameReturnValue>();

            registryKeyNameReturnValues.Add(new RegistryKeyNameReturnValue()
            {
                KeyName = registryCurrentVersionKeyName, ValueName = releaseIdKeyName, ReturnValue = expectedReleaseId
            });
            registryKeyNameReturnValues.Add(new RegistryKeyNameReturnValue()
            {
                KeyName = registryCurrentVersionKeyName, ValueName = UBRkeyName, ReturnValue = expectedUbr
            });
            registryKeyNameReturnValues.Add(new RegistryKeyNameReturnValue()
            {
                KeyName = registryCurrentVersionKeyName, ValueName = DisplayVersionKeyName, ReturnValue = expectedDisplayVersion
            });

            RegistryProviderMock registryProviderMock = new RegistryProviderMock(registryKeyNameReturnValues);

            // act
            MajorVersion10Properties majorVersion10Properties = new MajorVersion10Properties(registryProviderMock);

            // assert
            Assert.AreEqual(expectedReleaseId, majorVersion10Properties.ReleaseId);
            Assert.AreEqual(expectedUbr, majorVersion10Properties.UBR);
            Assert.AreEqual(expectedDisplayVersion, majorVersion10Properties.DisplayVersion);
        }
        public void GivenNonExistingValueNameExpectZeroValues()
        {
            // arrange
            string wrongValueName    = "ThisIsWrongForSureIndeed!";
            string expectedReleaseId = null;
            string expectedUbr       = null;

            List <RegistryKeyNameReturnValue> registryKeyNameReturnValues = new List <RegistryKeyNameReturnValue>();

            registryKeyNameReturnValues.Add(new RegistryKeyNameReturnValue()
            {
                KeyName = registryCurrentVersionKeyName, ValueName = wrongValueName, ReturnValue = expectedReleaseId
            });
            registryKeyNameReturnValues.Add(new RegistryKeyNameReturnValue()
            {
                KeyName = registryCurrentVersionKeyName, ValueName = wrongValueName, ReturnValue = expectedUbr
            });

            RegistryProviderMock registryProviderMock = new RegistryProviderMock(registryKeyNameReturnValues);

            // act
            MajorVersion10Properties majorVersion10Properties = new MajorVersion10Properties(registryProviderMock);

            // assert
            Assert.IsNull(majorVersion10Properties.ReleaseId);
            Assert.IsNull(majorVersion10Properties.UBR);
        }
        public void GivenNonExistingKeyNameExpectNullValues()
        {
            // arrange
            string wrongCurrentVersionKeyName = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion_NOT_EXISTING";
            string expectedReleaseId          = null;
            string expectedUbr = null;

            List <RegistryKeyNameReturnValue> registryKeyNameReturnValues = new List <RegistryKeyNameReturnValue>();

            registryKeyNameReturnValues.Add(new RegistryKeyNameReturnValue()
            {
                KeyName = wrongCurrentVersionKeyName, ValueName = releaseIdKeyName, ReturnValue = expectedReleaseId
            });
            registryKeyNameReturnValues.Add(new RegistryKeyNameReturnValue()
            {
                KeyName = wrongCurrentVersionKeyName, ValueName = UBRkeyName, ReturnValue = expectedUbr
            });

            RegistryProviderMock registryProviderMock = new RegistryProviderMock(registryKeyNameReturnValues);

            // act
            MajorVersion10Properties majorVersion10Properties = new MajorVersion10Properties(registryProviderMock);

            // assert
            Assert.IsNull(majorVersion10Properties.ReleaseId);
            Assert.IsNull(majorVersion10Properties.UBR);
        }
        public void GivenDisplayVersionNotExistingExpectReleaseId(string mockedReleaseId, string mockedUBR)
        {
            // arrange
            List <RegistryKeyNameReturnValue> registryKeyNameReturnValues = new List <RegistryKeyNameReturnValue>();

            registryKeyNameReturnValues.Add(new RegistryKeyNameReturnValue()
            {
                KeyName = registryCurrentVersionKeyName, ValueName = releaseIdKeyName, ReturnValue = mockedReleaseId
            });
            registryKeyNameReturnValues.Add(new RegistryKeyNameReturnValue()
            {
                KeyName = registryCurrentVersionKeyName, ValueName = UBRkeyName, ReturnValue = mockedUBR
            });

            RegistryProviderMock registryProviderMock = new RegistryProviderMock(registryKeyNameReturnValues);

            // act
            MajorVersion10Properties majorVersion10Properties = new MajorVersion10Properties(registryProviderMock);

            // assert
            Assert.AreEqual(majorVersion10Properties.ReleaseId, majorVersion10Properties.DisplayVersion);
        }