Пример #1
0
        public void Create_Tissue2D_WithCorrectLocationOrigin(int x, int y,
                                                              [FloatAsRatio] float living,
                                                              [Frozen(Matching.ImplementedInterfaces)]
                                                              ReverseTestShuffler shuffler, //we need to make sure max Location is in but do not want to use a complex shuffler
                                                              Tissue2DFactory sut)
        {
            Tissue2D result = sut.Create(x, y, living, 1 - living);

            VerifyLocationBounds(x, y, result);
        }
Пример #2
0
        public void Create_Tissue2D_WithCorrectNumberOfCells(int x, int y,
                                                             [FloatAsRatio] float living,
                                                             [Frozen(Matching.ImplementedInterfaces)]
                                                             NullShuffle shuffler,
                                                             Tissue2DFactory sut)
        {
            Tissue2D result = sut.Create(x, y, living, 1 - living);

            result.Tissue.Count.Should().Be(x * y);
        }
Пример #3
0
        public void Create_Tissue2D_AllPositionsAreCreated(
            [MinMaxInt(0, 50)] int x,
            [MinMaxInt(0, 50)] int y,
            [FloatAsRatio] float variableRatio,
            [Frozen(Matching.ImplementedInterfaces)]
            NullShuffle shuffler, //do not shuffle but inject when generating sut
            Tissue2DFactory sut)
        {
            var infected = variableRatio;
            var healthy  = 1 - variableRatio;

            var result = sut.Create(x, y, healthy, infected);

            VerifyAllLocationAreCreated(x, y, result);
        }
Пример #4
0
        public void Create_Tissue2D_CorrectCellsRatiosAreCreated(int x, int y,
                                                                 [FloatAsRatio] float variableRatio,
                                                                 [Frozen(Matching.ImplementedInterfaces)]
                                                                 NullShuffle shuffler, //do not shuffle but inject when generating sut
                                                                 [Frozen] ICellFactory cellFactory,
                                                                 Tissue2DFactory sut)
        {
            var infected = variableRatio;
            var healthy  = 1 - variableRatio;

            (int expectedHealthyCells, int expectedInfectedCells, int expectedEmptyPlaces)
                = CalculateExpectations(x, y, healthy, infected);

            _ = sut.Create(x, y, healthy, infected);

            var cellFactoryMock = Mock.Get(cellFactory);

            VerifyCorrectCellCounts(cellFactoryMock, expectedHealthyCells, expectedInfectedCells, expectedEmptyPlaces);
        }