public void SampleFactoryTest() { SampleFactory sampleFactory = new SampleFactory(); IProduct product = sampleFactory.Create(Category.A); Assert.AreEqual(product.GetType(), typeof(ConcreteProductA)); }
public void Create__result_contains_samples() { var dive = new Dive(1, 400, 400, "image"); var pixel = (new[] { new Pixel(1, 1), new Pixel(2, 3), new Pixel(3, 5), new Pixel(4, 5), new Pixel(5, 1) }).ToList(); var fac = new SampleFactory(); var processedDive = fac.Create(pixel, dive); processedDive.Samples.Count.Should().Be(pixel.Count); }
public void Create__runs_mulitple_post_processing() { var dive = new Dive(1, 400, 400, "image"); var pixel = (new[] { new Pixel(0, 0), new SkipPixel(1, 2), new SkipPixel(2, 4), new Pixel(3, 4), new Pixel(4, 0) }).ToList(); var postProcess1 = new Mock<IPostProcessing>(); var postProcess2 = new Mock<IPostProcessing>(); var fac = new SampleFactory(); fac.AddPostProcessing(postProcess1.Object); fac.AddPostProcessing(postProcess2.Object); var processedDive = fac.Create(pixel, dive); postProcess1.Verify(pp => pp.Process(processedDive), Times.Once()); postProcess2.Verify(pp => pp.Process(processedDive), Times.Once()); }
public void Create__calculate_average_for_skip_pixels() { throw new NotImplementedException("implement"); var dive = new Dive(1, 400, 400, "image"); var pixel = (new[] { new Pixel(0, 0), new SkipPixel(1, 2), new SkipPixel(2, 4), new Pixel(3, 4), new Pixel(4, 0) }).ToList(); var fac = new SampleFactory(); var processedDive = fac.Create(pixel, dive); processedDive.Samples.Should().HaveCount(3); processedDive.Samples[0].Depth.Should().Be(0); processedDive.Samples[0].SecondsSinceStart.Should().Be(0); processedDive.Samples[1].Depth.Should().Be(400); processedDive.Samples[1].SecondsSinceStart.Should().Be(300); processedDive.Samples[2].Depth.Should().Be(0); processedDive.Samples[2].SecondsSinceStart.Should().Be(400); }
public void Create__using_first_pixel_as_origin_and_returns_samples_having_correct_values() { var dive = new Dive(1, 400, 400, "image"); var pixel = (new[] { new Pixel(70, 50), new Pixel(71, 52), new Pixel(72, 54), new Pixel(73, 54), new Pixel(74, 50) }).ToList(); var fac = new SampleFactory(); var processedDive = fac.Create(pixel, dive); processedDive.Samples[0].Depth.Should().Be(0); processedDive.Samples[0].SecondsSinceStart.Should().Be(0); processedDive.Samples[1].Depth.Should().Be(200); processedDive.Samples[1].SecondsSinceStart.Should().Be(100); processedDive.Samples[2].Depth.Should().Be(400); processedDive.Samples[2].SecondsSinceStart.Should().Be(200); processedDive.Samples[3].Depth.Should().Be(400); processedDive.Samples[3].SecondsSinceStart.Should().Be(300); processedDive.Samples[4].Depth.Should().Be(0); processedDive.Samples[4].SecondsSinceStart.Should().Be(400); }
public void Create__samples_have_correct_values() { var dive = new Dive(1, 400, 400, "image"); var pixel = (new[] { new Pixel(0, 0), new Pixel(1, 2), new Pixel(2, 4), new Pixel(3, 4), new Pixel(4, 0) }).ToList(); var fac = new SampleFactory(); var processedDive = fac.Create(pixel, dive); processedDive.Samples[0].Depth.Should().Be(0); processedDive.Samples[0].SecondsSinceStart.Should().Be(0); processedDive.Samples[1].Depth.Should().Be(200); processedDive.Samples[1].SecondsSinceStart.Should().Be(100); processedDive.Samples[2].Depth.Should().Be(400); processedDive.Samples[2].SecondsSinceStart.Should().Be(200); processedDive.Samples[3].Depth.Should().Be(400); processedDive.Samples[3].SecondsSinceStart.Should().Be(300); processedDive.Samples[4].Depth.Should().Be(0); processedDive.Samples[4].SecondsSinceStart.Should().Be(400); }