Example #1
0
        public static void MapUnameCommandOutputToUnameItem(uname_item item, string terminalOutput)
        {
            var unameParts = terminalOutput.SplitStringByDefaultNewLine().ToArray();

            item.os_name        = OvalHelper.CreateItemEntityWithStringValue(unameParts[0]);
            item.node_name      = OvalHelper.CreateItemEntityWithStringValue(unameParts[1]);
            item.os_release     = OvalHelper.CreateItemEntityWithStringValue(unameParts[2]);
            item.os_version     = OvalHelper.CreateItemEntityWithStringValue(unameParts[3]);
            item.machine_class  = OvalHelper.CreateItemEntityWithStringValue(unameParts[4]);
            item.processor_type = OvalHelper.CreateItemEntityWithStringValue(unameParts[5]);
        }
Example #2
0
        public void Should_be_possible_map_uname_command_output_to_uname_item()
        {
            var itemToMap = new uname_item();

            UnixTerminalParser.MapUnameCommandOutputToUnameItem(
                itemToMap, FakeTerminalOutputFactory.GetUnameReturn());

            Assert.AreEqual("Linux", itemToMap.os_name.Value);
            Assert.AreEqual("Fedora13VM", itemToMap.node_name.Value);
            Assert.AreEqual("2.6.34.7-56.fc13.x86_64", itemToMap.os_release.Value);
            Assert.AreEqual("#1 SMP Wed Sep 15 03:36:55 UTC 2010", itemToMap.os_version.Value);
            Assert.AreEqual("x86_64", itemToMap.machine_class.Value);
            Assert.AreEqual("x86_64", itemToMap.processor_type.Value);
        }