public void Move_RegExServiceDoesNotMatch_Returns( [Frozen] IMainModel model, [Frozen] IFindTracksRegExService findTracksRegExService, [Frozen] IParseAndAddFloatValue parseAndAddFloatValue, MoveTracksService sut, string dummyContent) { //Arrange model.FileContent.Returns(dummyContent); findTracksRegExService.MatchRegex(dummyContent).Returns(new RegexServiceResponseModel()); //Act sut.Move(); //Assert model.ReceivedCalls().Should().HaveCount(1); findTracksRegExService.ReceivedCalls().Should().HaveCount(1); findTracksRegExService.Received(1).MatchRegex(dummyContent); parseAndAddFloatValue.ReceivedCalls().Should().BeEmpty(); }
public void Move_RegExMatchDoesNotContainPercentChar_ReplacesOneLine( [Frozen] IMainModel model, [Frozen] IFindObjectsRegExService findObjectsRegExService, [Frozen] IParseAndAddFloatValue parseAndAddFloatValue, MoveObjectsService sut, string dummyContent, RegexServiceResponseModel regexServiceResponseModel, string dummyRegex, float dummyX, float dummyY, float dummyZ) { //Arrange var source = "table_square_0,1,16.48622_-0.2120953_61.54293,-1.347026E-05_270_-1.018759E-06,-1,1,0,0,0,-1,,-1,kcc0:h0:s0:v49:lr50:hr20,0,,"; var expectedResult = "table_square_0,1,X_Y_Z,-1.347026E-05_270_-1.018759E-06,-1,1,0,0,0,-1,,-1,kcc0:h0:s0:v49:lr50:hr20,0,,"; model.FileContent.Returns(dummyContent); model.MoveXAxisValue.Returns(dummyX); model.MoveYAxisValue.Returns(dummyY); model.MoveZAxisValue.Returns(dummyZ); regexServiceResponseModel.HasMatched = true; regexServiceResponseModel.Content = source; regexServiceResponseModel.MatchingRegEx = dummyRegex; findObjectsRegExService.MatchRegex(dummyContent).Returns(regexServiceResponseModel); parseAndAddFloatValue.For("16.48622", dummyX).Returns("X"); parseAndAddFloatValue.For("-0.2120953", dummyY).Returns("Y"); parseAndAddFloatValue.For("61.54293", dummyZ).Returns("Z"); //Act sut.Move(); //Assert model.ReceivedCalls().Should().HaveCount(6); findObjectsRegExService.ReceivedCalls().Should().HaveCount(2); findObjectsRegExService.Received(1).MatchRegex(dummyContent); findObjectsRegExService.Received(1).Replace(dummyContent, expectedResult, regexServiceResponseModel.MatchingRegEx); }
public MoveWaggonsService(IMainModel mainModel, IFindWaggonsRegExService findTracksRegExService, IParseAndAddFloatValue parseAndAddFloatValue) : base(mainModel, findTracksRegExService, parseAndAddFloatValue) { }
protected MoveSomethingService(IMainModel mainModel, IRegExService regExService, IParseAndAddFloatValue parseAndAddFloatValue) { _mainModel = mainModel ?? throw new ArgumentNullException(nameof(mainModel)); _regExService = regExService ?? throw new ArgumentNullException(nameof(regExService)); _parseAndAddFloatValue = parseAndAddFloatValue ?? throw new ArgumentNullException(nameof(parseAndAddFloatValue)); }