Esempio n. 1
0
        public void From_Win32BaseBoardIsNull_ThrowsNullReferenceException()
        {
            //Arrange
            Win32_BaseBoard win32BaseBoard         = null;
            var             win32MotherboardDevice = new Win32_MotherboardDevice
            {
                PrimaryBusType   = "PrimeryBusType",
                SecondaryBusType = "SecondaryBusType",
            };

            //Act
            //Assert
            Assert.Throws <NullReferenceException>(() => MainboardMapper.From(win32BaseBoard, win32MotherboardDevice));
        }
Esempio n. 2
0
        public void From_Win32MotherboardDeviceIsNull_ReturnsMainboard()
        {
            //Arrange
            var win32BaseBoard = new Win32_BaseBoard()
            {
                Manufacturer = "Manufacturer",
                Product      = "Product",
            };
            Win32_MotherboardDevice win32MotherboardDevice = null;

            //Act
            //Assert
            Assert.Throws <NullReferenceException>(() => MainboardMapper.From(win32BaseBoard, win32MotherboardDevice));
        }
Esempio n. 3
0
        public async Task <Result <Mainboard> > GetPhysicalMainboardAsync()
        {
            try
            {
                var baseBoards = await Task.Run(() => _componentRepo.Get <Win32_BaseBoard>());

                var motherboardDevice = await Task.Run(() => _componentRepo.Get <Win32_MotherboardDevice>());

                var output = MainboardMapper.From(baseBoards.Single(), motherboardDevice.Single());

                return(Result <Mainboard> .Ok(output));
            }
            catch (Exception e)
            {
                return(Result <Mainboard> .Fail(e));
            }
        }
Esempio n. 4
0
        public void From_ProductIsEmpty_ReturnsMainboard()
        {
            //Arrange
            var win32BaseBoard = new Win32_BaseBoard()
            {
                Manufacturer = "Manufacturer",
                Product      = string.Empty,
            };
            var win32MotherboardDevice = new Win32_MotherboardDevice
            {
                PrimaryBusType   = "PrimeryBusType",
                SecondaryBusType = "SecondaryBusType",
            };

            //Act
            var result = MainboardMapper.From(win32BaseBoard, win32MotherboardDevice);

            //Assert
            Assert.NotNull(result);
            Assert.True(result.Manufacturer == win32BaseBoard.Manufacturer);
            Assert.True(result.Model == win32BaseBoard.Product);
            Assert.True(result.PrimaryBusType == win32MotherboardDevice.PrimaryBusType);
            Assert.True(result.SecondaryBusType == win32MotherboardDevice.SecondaryBusType);
        }