public void BuildMachineId_WithValue_CreatesIdWithProductId() { var registry = MockRepository.GenerateStub <IRegistry>(); registry.Stub(x => x.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductId", null)).Return("FAKE_ID"); Func <long> getSerialFunc = () => 0; var machineId = MachineId.BuildCurrentMachineId(getSerialFunc, registry); Assert.AreEqual("FAKE_ID", machineId.WindowsProductId); }
public void BuildMachineId_WithVolumeSerialFuncion_AppliesCorrectSerial() { var registry = MockRepository.GenerateStub <IRegistry>(); registry.Stub(x => x.GetValue("", "", "")).IgnoreArguments().Return(""); Func <long> getSerialFunc = () => 123456789; var machineId = MachineId.BuildCurrentMachineId(getSerialFunc, registry); Assert.AreEqual(123456789, machineId.SystemVolumeSerial); }
public void BuildMachineId_WithNonexistingRegistryKey_CreatesIdWithEmptyString() { var registry = MockRepository.GenerateStub <IRegistry>(); registry.Stub(x => x.GetValue("", "", "")).IgnoreArguments().Return(""); Func <long> getSerialFunc = () => 0; var machineId = MachineId.BuildCurrentMachineId(getSerialFunc, registry); Assert.AreEqual("", machineId.WindowsProductId); }