|
| 1 | +namespace Microsoft.ComponentDetection.Orchestrator.Tests.Experiments; |
| 2 | + |
| 3 | +using AwesomeAssertions; |
| 4 | +using Microsoft.ComponentDetection.Detectors.Linux; |
| 5 | +using Microsoft.ComponentDetection.Detectors.Npm; |
| 6 | +using Microsoft.ComponentDetection.Detectors.Pip; |
| 7 | +using Microsoft.ComponentDetection.Orchestrator.Experiments.Configs; |
| 8 | +using Microsoft.VisualStudio.TestTools.UnitTesting; |
| 9 | + |
| 10 | +[TestClass] |
| 11 | +public class LinuxApplicationLayerExperimentTests |
| 12 | +{ |
| 13 | + private readonly LinuxApplicationLayerExperiment experiment = new(); |
| 14 | + |
| 15 | + [TestMethod] |
| 16 | + public void IsInControlGroup_LinuxContainerDetector_ReturnsTrue() |
| 17 | + { |
| 18 | + var linuxDetector = new LinuxContainerDetector(null, null, null); |
| 19 | + this.experiment.IsInControlGroup(linuxDetector).Should().BeTrue(); |
| 20 | + } |
| 21 | + |
| 22 | + [TestMethod] |
| 23 | + public void IsInControlGroup_NpmComponentDetector_ReturnsTrue() |
| 24 | + { |
| 25 | + var npmDetector = new NpmComponentDetector(null, null, null); |
| 26 | + this.experiment.IsInControlGroup(npmDetector).Should().BeTrue(); |
| 27 | + } |
| 28 | + |
| 29 | + [TestMethod] |
| 30 | + public void IsInControlGroup_NpmLockfile3Detector_ReturnsTrue() |
| 31 | + { |
| 32 | + var npmLockfile3Detector = new NpmLockfile3Detector(null, null, null, null); |
| 33 | + this.experiment.IsInControlGroup(npmLockfile3Detector).Should().BeTrue(); |
| 34 | + } |
| 35 | + |
| 36 | + [TestMethod] |
| 37 | + public void IsInControlGroup_NpmComponentDetectorWithRoots_ReturnsTrue() |
| 38 | + { |
| 39 | + var npmDetectorWithRoots = new NpmComponentDetectorWithRoots(null, null, null, null); |
| 40 | + this.experiment.IsInControlGroup(npmDetectorWithRoots).Should().BeTrue(); |
| 41 | + } |
| 42 | + |
| 43 | + [TestMethod] |
| 44 | + public void IsInControlGroup_PipReportComponentDetector_ReturnsTrue() |
| 45 | + { |
| 46 | + var pipDetector = new PipReportComponentDetector( |
| 47 | + null, |
| 48 | + null, |
| 49 | + null, |
| 50 | + null, |
| 51 | + null, |
| 52 | + null, |
| 53 | + null, |
| 54 | + null, |
| 55 | + null |
| 56 | + ); |
| 57 | + |
| 58 | + this.experiment.IsInControlGroup(pipDetector).Should().BeTrue(); |
| 59 | + } |
| 60 | + |
| 61 | + [TestMethod] |
| 62 | + public void IsInControlGroup_LinuxApplicationLayerDetector_ReturnsFalse() |
| 63 | + { |
| 64 | + var experimentalDetector = new LinuxApplicationLayerDetector(null, null, null); |
| 65 | + this.experiment.IsInControlGroup(experimentalDetector).Should().BeFalse(); |
| 66 | + } |
| 67 | + |
| 68 | + [TestMethod] |
| 69 | + public void IsInExperimentGroup_LinuxApplicationLayerDetector_ReturnsTrue() |
| 70 | + { |
| 71 | + var experimentalDetector = new LinuxApplicationLayerDetector(null, null, null); |
| 72 | + this.experiment.IsInExperimentGroup(experimentalDetector).Should().BeTrue(); |
| 73 | + } |
| 74 | + |
| 75 | + [TestMethod] |
| 76 | + public void IsInExperimentGroup_LinuxContainerDetector_ReturnsFalse() |
| 77 | + { |
| 78 | + var linuxDetector = new LinuxContainerDetector(null, null, null); |
| 79 | + this.experiment.IsInExperimentGroup(linuxDetector).Should().BeFalse(); |
| 80 | + } |
| 81 | + |
| 82 | + [TestMethod] |
| 83 | + public void IsInExperimentGroup_NpmComponentDetector_ReturnsFalse() |
| 84 | + { |
| 85 | + var npmDetector = new NpmComponentDetector(null, null, null); |
| 86 | + this.experiment.IsInExperimentGroup(npmDetector).Should().BeFalse(); |
| 87 | + } |
| 88 | + |
| 89 | + [TestMethod] |
| 90 | + public void IsInExperimentGroup_NpmLockfile3Detector_ReturnsFalse() |
| 91 | + { |
| 92 | + var npmLockfile3Detector = new NpmLockfile3Detector(null, null, null, null); |
| 93 | + this.experiment.IsInExperimentGroup(npmLockfile3Detector).Should().BeFalse(); |
| 94 | + } |
| 95 | + |
| 96 | + [TestMethod] |
| 97 | + public void IsInExperimentGroup_NpmComponentDetectorWithRoots_ReturnsFalse() |
| 98 | + { |
| 99 | + var npmDetectorWithRoots = new NpmComponentDetectorWithRoots(null, null, null, null); |
| 100 | + this.experiment.IsInExperimentGroup(npmDetectorWithRoots).Should().BeFalse(); |
| 101 | + } |
| 102 | + |
| 103 | + [TestMethod] |
| 104 | + public void IsInExperimentGroup_PipReportComponentDetector_ReturnsFalse() |
| 105 | + { |
| 106 | + var pipDetector = new PipReportComponentDetector( |
| 107 | + null, |
| 108 | + null, |
| 109 | + null, |
| 110 | + null, |
| 111 | + null, |
| 112 | + null, |
| 113 | + null, |
| 114 | + null, |
| 115 | + null |
| 116 | + ); |
| 117 | + |
| 118 | + this.experiment.IsInExperimentGroup(pipDetector).Should().BeFalse(); |
| 119 | + } |
| 120 | +} |
0 commit comments