Exemplo n.º 1
0
        public void From_MaxRefreshRateIsNull_ReturnsGPU()
        {
            //Arrange
            var win32VideoController = new Win32_VideoController
            {
                Availability = 1,
                CurrentVerticalResolution   = 1,
                CurrentHorizontalResolution = 1,
                Caption               = "Caption1",
                AdapterRAM            = 1073741824,
                AdapterDACType        = "AdapterDACType",
                VideoArchitecture     = 1,
                CurrentNumberOfColors = 1,
                MaxRefreshRate        = null
            };

            //Act
            var result = GPUMapper.From(win32VideoController);

            //Assert
            Assert.NotNull(result);
            Assert.True(result.Availability == "Other");
            Assert.True(result.Height == win32VideoController.CurrentVerticalResolution);
            Assert.True(result.Width == win32VideoController.CurrentHorizontalResolution);
            Assert.True(result.NumberOfColors == (long)win32VideoController.CurrentNumberOfColors);
            Assert.True(result.Name == win32VideoController.Caption);
            Assert.True(result.Capacity == 1);
            Assert.True(result.AdapterDACType == win32VideoController.AdapterDACType);
            Assert.True(result.VideoArchitecture == "Other");
            Assert.True(result.MaxRefreshRate == Constants.DefaultNumericValue);
        }
Exemplo n.º 2
0
        public void From_ParameterIsNull_ThrowsNullReferenceException()
        {
            //Arrange
            Win32_VideoController win32VideoController = null;

            //Act
            //Assert
            Assert.Throws <NullReferenceException>(() => GPUMapper.From(win32VideoController));
        }
Exemplo n.º 3
0
        public async Task <Result <IEnumerable <GPU> > > GetPhysicalGPUsAsync()
        {
            try
            {
                var result = await Task.Run(() => _componentRepo.Get <Win32_VideoController>());

                var output = result.Select(x => GPUMapper.From(x));

                return(Result <IEnumerable <GPU> > .Ok(output));
            }
            catch (Exception e)
            {
                return(Result <IEnumerable <GPU> > .Fail(e));
            }
        }
Exemplo n.º 4
0
        public void From_VariousAvailabilities_ReturnsGPU(ushort availability, string decoded)
        {
            //Arrange
            var win32VideoController = new Win32_VideoController
            {
                Availability = availability,
                CurrentVerticalResolution   = 1,
                CurrentHorizontalResolution = 1,
                Caption               = "Caption1",
                AdapterRAM            = 1073741824,
                AdapterDACType        = "AdapterDACType",
                VideoArchitecture     = 1,
                CurrentNumberOfColors = 1,
                MaxRefreshRate        = 1
            };

            //Act
            var result = GPUMapper.From(win32VideoController);

            //Assert
            Assert.NotNull(result);
            Assert.True(result.Availability == decoded);
        }