public void GetSystemVersionNumberReturnsDLLVersionOfCoreProject() { ISystemInformationFactory systemInformationFactory = new SystemInformationFactory(); ISystemInformationRepository systemInformationRepository = new SystemInformationRepository(); string assemblyVersionNumber = Assembly.GetAssembly(typeof(Falcon.App.Core.Domain.DomainObjectBase)).GetName().Version.ToString(); string expectedVersionNumber = systemInformationFactory.GetFormattedVersionString(assemblyVersionNumber); string actualVersionNumber = systemInformationRepository.GetSystemVersionNumber(); Assert.IsNotNull(actualVersionNumber); Assert.AreEqual(expectedVersionNumber, actualVersionNumber); Debug.Print(actualVersionNumber); }
public static void Main(string[] args) { var factory = new SystemInformationFactory(); var system = factory.GetSystemInfo(); Console.WriteLine("OemId: {0}", system.OemProcessorArch.OemId); Console.WriteLine("ProcessorArch: {0}", system.OemProcessorArch.ProcessorArch); Console.WriteLine("ActiveProcessorMask: {0}", system.ActiveProcessorMask.ToUInt64()); Console.WriteLine("AllocationGranularity: {0}", system.AllocationGranularity); Console.WriteLine("MaximumApplicationAddress: {0}", system.MaximumApplicationAddress.ToUInt64()); Console.WriteLine("MinimumApplicationAddress: {0}", system.MinimumApplicationAddress.ToUInt64()); Console.WriteLine("NumberOfProcessors: {0}", system.NumberOfProcessors); Console.WriteLine("PageSize: {0}", system.PageSize); Console.WriteLine("ProcessorLevel: {0}", system.ProcessorLevel); Console.WriteLine("ProcessorRevision: {0}", system.ProcessorRevision); Console.WriteLine("ProcessorType: {0}", system.ProcessorType); }
private RegistryProber GetMockedRegistryProber(registry_item fakeItem) { var fakeValues = new List <String>(new string[] { "FakeValue" }); var fakeCollectedItems = new CollectedItem[] { ProbeHelper.CreateFakeCollectedItem(fakeItem) }; MockRepository mocks = new MockRepository(); var fakeConnection = mocks.DynamicMock <IConnectionManager>(); var fakeSystemInformation = mocks.DynamicMock <ISystemInformationService>(); var fakeProvider = mocks.DynamicMock <RegistryConnectionProvider>(); var fakeWmiProvider = new WmiDataProviderExpectFactory().GetFakeWmiDataProviderForTestInvokeMethodEnumKeyWithReturnSuccess(); var fakeDataCollector = mocks.DynamicMock <RegistryObjectCollector>(); fakeDataCollector.WmiDataProvider = fakeWmiProvider; var registryItemTypeGeneration = new RegistryItemTypeGenerator() { SystemDataSource = fakeDataCollector, WmiDataProvider = fakeWmiProvider }; Expect.Call(fakeConnection.Connect <RegistryConnectionProvider>(null, null)).IgnoreArguments().Repeat.Any().Return(fakeProvider); Expect.Call(fakeDataCollector.CollectDataForSystemItem(fakeItem)).IgnoreArguments().Repeat.Any().Return(fakeCollectedItems); Expect.Call(fakeDataCollector.GetValues(null)).IgnoreArguments().Repeat.Any().Return(fakeValues); Expect.Call(fakeSystemInformation.GetSystemInformationFrom(null)).IgnoreArguments().Return(SystemInformationFactory.GetExpectedSystemInformation()); mocks.ReplayAll(); return(new RegistryProber() { ConnectionManager = fakeConnection, ObjectCollector = fakeDataCollector, ItemTypeGenerator = registryItemTypeGeneration }); }
private SystemInformation GetExpectedSystemInformation() { return(SystemInformationFactory.GetExpectedSystemInformation()); }
private FileProber GetMockedFileProber(file_item fakeItem) { IList <String> fakeValues = new List <String>(new string[] { "FakeValue" }); CollectedItem fakeCollectedItem = ProbeHelper.CreateFakeCollectedItem(fakeItem); MockRepository mocks = new MockRepository(); IConnectionManager fakeConnection = mocks.DynamicMock <IConnectionManager>(); ISystemInformationService fakeSystemInformation = mocks.DynamicMock <ISystemInformationService>(); FileConnectionProvider fakeProvider = mocks.DynamicMock <FileConnectionProvider>(); WmiDataProvider fakeWmiProvider = mocks.DynamicMock <WmiDataProvider>(); FileObjectCollector fakeDataCollector = mocks.DynamicMock <FileObjectCollector>(); fakeDataCollector.WmiDataProvider = fakeWmiProvider; //Expect.Call(fakeConnection.Connect<FileConnectionProvider>(null, null)).IgnoreArguments().Repeat.Any().Return(fakeProvider); Expect.Call(fakeDataCollector.CollectDataForSystemItem(fakeItem)).IgnoreArguments().Repeat.Any().Return(new List <CollectedItem>() { fakeCollectedItem }); Expect.Call(fakeDataCollector.GetValues(null)).IgnoreArguments().Repeat.Any().Return(fakeValues); Expect.Call(fakeSystemInformation.GetSystemInformationFrom(null)).IgnoreArguments().Return(SystemInformationFactory.GetExpectedSystemInformation()); mocks.ReplayAll(); return(new FileProber() { ConnectionManager = fakeConnection, ObjectCollector = fakeDataCollector }); }
private FamilyProberWindows GetFamilyProber() { MockRepository mocks = new MockRepository(); var fakeFamilyDataSource = mocks.DynamicMock <BaseObjectCollector>(); var fakeInformationService = mocks.DynamicMock <ISystemInformationService>(); var fakeConnectionManager = mocks.DynamicMock <IConnectionManager>(); Expect.Call(fakeFamilyDataSource.CollectDataForSystemItem(null)).IgnoreArguments().Return(this.createFakeFamilyItem()); Expect.Call(fakeInformationService.GetSystemInformationFrom(null)).IgnoreArguments().Return(SystemInformationFactory.GetExpectedSystemInformation()); mocks.ReplayAll(); return(new FamilyProberWindows() { ObjectCollector = fakeFamilyDataSource, ConnectionManager = fakeConnectionManager }); }