public void SpecfileResult_NoErrors_IsNotInvalid() { var file = new File("symitar", "10", "FileName", FileType.RepGen, DateTime.Now, 100); var result = new SpecfileResult(file, "", "", 0, 0); result.InvalidInstall.Should().BeFalse(); }
public void FileCheck_ActionFileInfo_FailsCheck() { var mockSocket = Substitute.For <ISymSocket>(); mockSocket.ReadCommand() .Returns( new SymCommand("Check", new Dictionary <string, string> { { "Action", "Init" } }), new SymCommand("Check", new Dictionary <string, string> { { "Action", "Init" } }), new SymCommand("Check", new Dictionary <string, string> { { "Action", "Init" } }), new SymCommand("Check", new Dictionary <string, string> { { "Action", "Init" } }), new SymCommand("Check", new Dictionary <string, string> { { "Action", "FileInfo" }, { "Line", "22" }, { "Col", "1" } }), new SymCommand("Check", new Dictionary <string, string> { { "Action", "DisplayEdit" } }) ); var file = new File("symitar", "10", "FILE.TO.CHECK", FileType.RepGen, DateTime.Now, 110); var session = new SymSession(mockSocket, 10); SpecfileResult result = session.FileCheck(file); result.PassedCheck.Should().BeFalse(); }
public void SpecfileResult_WithErrors_IsInvalidInstall() { var file = new File("symitar", "10", "FileName", FileType.RepGen, DateTime.Now, 100); var result = new SpecfileResult(file, "FileName", "Invalid character", 100, 1); result.InvalidInstall.Should().BeTrue(); }
public void SpecfileResult_NoErrors_PropertiesReturnMatchingValues() { var file = new File("symitar", "10", "FileName", FileType.RepGen, DateTime.Now, 100); var result = new SpecfileResult(file, "", "", 0, 0); result.Specfile.Should().Be(file); result.FileWithError.Should().Be(""); result.ErrorMessage.Should().Be(""); result.Line.Should().Be(0); result.Column.Should().Be(0); }
public void FileCheck_ActionNoError_PassesCheck() { var mockSocket = Substitute.For <ISymSocket>(); mockSocket.ReadCommand() .Returns(new SymCommand("Check", new Dictionary <string, string> { { "Action", "NoError" } })); var file = new File("symitar", "10", "FILE.TO.CHECK", FileType.RepGen, DateTime.Now, 110); var session = new SymSession(mockSocket, 10); SpecfileResult result = session.FileCheck(file); result.PassedCheck.Should().BeTrue(); }
public void SpecfileResult_WithErrors_PropertiesReturnMatchingValues() { var line = 100; var column = 1; var error = "Invalid character"; var fileName = "FileName"; var file = new File("symitar", "10", fileName, FileType.RepGen, DateTime.Now, 100); var result = new SpecfileResult(file, fileName, error, line, column); result.Specfile.Should().Be(file); result.FileWithError.Should().Be(fileName); result.ErrorMessage.Should().Be(error); result.Line.Should().Be(line); result.Column.Should().Be(column); }
private void FileInstallTest(string fileName) { try { var file = new File { Name = fileName, Type = FileType.RepGen }; SpecfileResult result = _session.FileInstall(file); LogResponse(_session.Log.Aggregate((a, b) => a + "\n" + b)); LogResponse(result.PassedCheck); LogResponse(result.FileWithError); LogResponse(result.ErrorMessage); } catch (Exception ex) { LogResponse(_session.Log.Aggregate((a, b) => a + "\n" + b)); LogResponse(ex.Message); } finally { _session.Log.Clear(); } }
public void SpecfileError_Success_PassesCheck() { SpecfileResult result = SpecfileResult.Success(); result.PassedCheck.Should().BeTrue(); }
public void SpecfileError_SuccessWithInstallSize_HasCorrectInstallSize() { SpecfileResult result = SpecfileResult.Success(100); result.InstallSize.Should().Be(100); }
public void SpecfileError_SuccessWithInstallSizeUnder0_ThrowsException() { Assert.Throws <ArgumentOutOfRangeException>( () => { SpecfileResult result = SpecfileResult.Success(-1); } ); }
public void SpecfileError_SuccessWithInstallSizeOver0_PassesCheck() { SpecfileResult result = SpecfileResult.Success(100); result.PassedCheck.Should().BeTrue(); }
public void SpecfileError_SuccessWithInstallSizeEqual0_FailsCheck() { SpecfileResult result = SpecfileResult.Success(0); result.PassedCheck.Should().BeFalse(); }