コード例 #1
0
        public void Demodulator_Demodulate_NoizyDemodulatorStrategy_ReturnsListModifiedAccordingToNoizyDemodulatorLogic()
        {
            var expectedResult = TestData.NoizyDemodulationHandlerLogic(_testDoubleArray.First());
            var demodulator    = new Demodulator(new NoizyDemodulator());

            var actualResult = demodulator.Demodulate(_testDoubleArray);

            Assert.Equal(expectedResult, actualResult.First());
        }
コード例 #2
0
        public void Demodulator__Demodulate_PassedNullListValue_ThrowsArgumentNullException()
        {
            List <double> nullList          = null;
            var           simpleDemodulator = new Demodulator(new SimpleDemodulator());
            var           noisyDemodulator  = new Demodulator(new NoizyDemodulator());

            Assert.Throws <ArgumentNullException>(() => simpleDemodulator.Demodulate(nullList));
            Assert.Throws <ArgumentNullException>(() => noisyDemodulator.Demodulate(nullList));
        }
コード例 #3
0
ファイル: FactoryTests.cs プロジェクト: Zascha/MP-Patterns
        public void GetDemodulator_NoizyDemodulator_NullListValue_ThrowsNullReferenceException()
        {
            List <double> nullList         = null;
            var           inputStringParam = "not-sand";

            var demodulatorInstance = Demodulator.GetDemodulator(inputStringParam);

            Assert.NotNull(demodulatorInstance);
            Assert.Throws <NullReferenceException>(() => demodulatorInstance.Demodulate(nullList));
        }
コード例 #4
0
        static void Main(string[] args)
        {
            var input = "[0,-1,0]";
            var entry = Parser.Parse(input);
            var mo    = entry.Modulate();

            Console.WriteLine(mo);
            var zzz = Demodulator.Demodulate(mo);

            zzz.Print(0);
        }
コード例 #5
0
ファイル: FactoryTests.cs プロジェクト: Zascha/MP-Patterns
        public void GetDemodulator_NoizyDemodulator_NotNullListValue_ReturnsModifiedInputArrayAccordingToNoizyDemodulatorLogic()
        {
            var inputStringParam = "not-sand";
            var expectedResult   = _noizyDemodulationHandlerLogic(_testDoubleArray.First());

            var demodulatorInstance = Demodulator.GetDemodulator(inputStringParam);
            var modifiedArray       = demodulatorInstance.Demodulate(_testDoubleArray);

            Assert.NotNull(demodulatorInstance);
            Assert.IsType <NoizyDemodulator>(demodulatorInstance);
            Assert.NotEmpty(modifiedArray);
            Assert.Equal(expectedResult, modifiedArray.First());
        }