示例#1
0
        public void ComputeModesMustCalculateFieldPressure()
        {
            var krakenNormalProgramMock = _krakenNormalModesProgramMocks
                                          .CalculateNormalModesReturnsKrakenResultAndCalculatedModesInfo();

            var fieldProgramMock = _fieldProgramMocks
                                   .CalculateFieldPressureReturnsAcousticFieldSnapshots(_testDataHelper.GetAcousticFieldSnapshots());

            var krakenInputProfileMapperMock    = _mappersMocks.KrakenInputProfileMapper(_testDataHelper.GetKrakenInputProfile());
            var fieldInputDataMapperMock        = _mappersMocks.FieldInputDataMapper(_testDataHelper.GetFieldInputData());
            var krakenComputingResultMapperMock = _mappersMocks.KrakenComputingResultMapper();

            var sut = new KrakenService(krakenNormalProgramMock.Object, fieldProgramMock.Object,
                                        krakenInputProfileMapperMock.Object, fieldInputDataMapperMock.Object,
                                        krakenComputingResultMapperMock.Object);

            var acousticProblemData = _testDataHelper.GetAcousticProblemDataForKrakenAndField();

            var result = sut.ComputeModes(acousticProblemData);

            krakenNormalProgramMock.Verify(x => x.CalculateNormalModes(It.IsAny <KrakenInputProfile>()), Times.Once());
            fieldProgramMock.Verify(x => x.CalculateFieldPressure(It.IsAny <FieldInputData>()), Times.Once());

            krakenInputProfileMapperMock.Verify(x => x.Map(It.IsAny <AcousticProblemData>()), Times.Once());
            fieldInputDataMapperMock.Verify(x => x.Map(It.IsAny <FieldComputingRequiredData>()), Times.Once());
            krakenComputingResultMapperMock.Verify(x => x.Map(It.IsAny <KrakenResultAndAcousticFieldSnapshots>()), Times.Once());
        }
示例#2
0
        public void ComputeModesShouldThrowsKrakenComputingExceptionWhenKrakenExceptionOccurs()
        {
            const string exceptionMessage = "test message";

            var krakenNormalProgramMock = _krakenNormalModesProgramMocks.CalculateNormalModesThrowsKrakenExceptionWithMessage(exceptionMessage);
            var fieldProgramMock        = _fieldProgramMocks.CalculateFieldPressureReturnsAcousticFieldSnapshots();

            var krakenInputProfileMapperMock    = _mappersMocks.KrakenInputProfileMapper(_testDataHelper.GetKrakenInputProfile());
            var fieldInputDataMapperMock        = _mappersMocks.FieldInputDataMapper(_testDataHelper.GetFieldInputData());
            var krakenComputingResultMapperMock = _mappersMocks.KrakenComputingResultMapper();

            var sut = new KrakenService(krakenNormalProgramMock.Object, fieldProgramMock.Object,
                                        krakenInputProfileMapperMock.Object, fieldInputDataMapperMock.Object,
                                        krakenComputingResultMapperMock.Object);

            var acousticProblemData = _testDataHelper.GetAcousticProblemDataForKraken();

            var message = Assert.Throws <KrakenComputingException>(() => sut.ComputeModes(acousticProblemData)).Message;

            Assert.Equal(exceptionMessage, message);

            krakenInputProfileMapperMock.Verify(x => x.Map(It.IsAny <AcousticProblemData>()), Times.Once());
            fieldInputDataMapperMock.Verify(x => x.Map(It.IsAny <FieldComputingRequiredData>()), Times.Never());
            krakenComputingResultMapperMock.Verify(x => x.Map(It.IsAny <KrakenResultAndAcousticFieldSnapshots>()), Times.Never());
        }