public void AppendDeclarations_Test() { var declaration = new Declaration { Name = "h1", Expression = null, Important = true }; var declarations = new List <Declaration> { declaration }; StringBuilder builder = null; string separator = " "; _parameters = new object[] { declarations, builder, separator }; // Act var testDelegate = new TestDelegate(InvokeMethod); // Assert Assert.Throws(typeof(System.Exception), testDelegate); // Arrange declarations = null; _parameters = new object[] { declarations, builder, separator }; // Act testDelegate = new TestDelegate(InvokeMethod); //Assert Assert.DoesNotThrow(testDelegate); }
public void Patient_Birthdate_ValidateCorrectValue_Correct() { var patient = new Patient(); patient.BirthDate = Convert.ToDateTime("01/09/1988"); Assert.DoesNotThrow(() => patient.ValidateBirthDate()); }
public void ExportSuccess() { // On successful export Assert.DoesNotThrow(() => _command.Run(Filename5)); File.Delete(Filename5); Assert.AreEqual($"Exported to \"{Filename5}\"", _command.Run(Filename5)); }
public void GetAll_NoExceptions() { IList <ToDoList> toDoLists = null; Assert.DoesNotThrow(() => toDoLists = _toDoListDao.GetAll()); Assert.NotNull(toDoLists); }
public void ShouldNotThrowErrorIfOrganisationNotFound() { _mockGetAssessmentOrgs.Setup(x => x.GetStandardsByOrganisationIdentifier(It.IsAny <string>())).Returns(new List <StandardOrganisationSummary>() { }); Assert.DoesNotThrow(() => _sut.GetStandardsByOrganisationId("EPA0001x")); }
public void Test_CanInstantiate() { Assert.DoesNotThrow(() => { new DbCommand(DbConnectionSql, "SELECT * FROM Sales"); }); }
public void ShouldNotThrowErrorIfStandardNotFound() { _mockGetAssessmentOrgs.Setup(x => x.GetOrganisationsByStandardId(It.IsAny <string>())).Returns(new List <Organisation>() { }); Assert.DoesNotThrow(() => _sut.GetByStandardId("111")); }
When_precondition_is_first_class_rule_in_plan_and_has_different_error_code_assigned_precondition_is_only_evaluated_once () { var count = 0; Func <Species, bool> counter = s => { count++; return(false); }; var precondition = Validate.That <Species>(s => counter(s)); var plan = new ValidationPlan <Species> { precondition.WithErrorCode("some code"), // these rules will throw if the precondition does not short circuit them Validate.That <Species>(species => species.Name.Length > 0) .When(precondition), Validate.That <Species>(species => !species.Name.Contains("!")) .When(precondition) }; var nameless = new Species { Name = null }; Assert.DoesNotThrow(() => plan.Execute(nameless)); Assert.AreEqual(1, count); }
public void Test_Execute() { var command = new DbCommand(DbConnectionSql, "SELECT * FROM Sales"); Assert.That(DbConnectionSql.IsConnected, Is.False); Assert.DoesNotThrow(command.Execute); Assert.That(DbConnectionSql.IsConnected, Is.False); }
public void CircleCreatingTest() { Assert.That(() => new Circle(0), Throws.TypeOf <ArgumentException>()); Assert.That(() => new Circle(-1), Throws.TypeOf <ArgumentException>()); Assert.DoesNotThrow(() => new Circle(5)); }
public void Page_Unload_NoErrors() { // Act var action = (TestDelegate)(() => _surveyReportPrivateObject.Invoke(PageUnloadMethod, new object[] { null, EventArgs.Empty })); // Assert Assert.DoesNotThrow(action); }
public void OnInit_NoError() { // Act var action = (TestDelegate)(() => _defineSurveyPrivateObject.Invoke(OnInitMethod, new object[] { EventArgs.Empty })); // Assert Assert.DoesNotThrow(action); }
public void Patient_Telephone_ValidateCorrectValue_Correct( [Values("123-", "123)", "(123", "123+", "123 2134")] string value ) { var patient = new Patient(); patient.Telephone = value; Assert.DoesNotThrow(() => patient.ValidateTelephone()); }
public void TestConstructor() { Assert.DoesNotThrow(() => new MessagePackExtendedTypeObject(0, new byte[1])); Assert.DoesNotThrow(() => new MessagePackExtendedTypeObject(127, new byte[1])); Assert.Throws <ArgumentException>(() => new MessagePackExtendedTypeObject(128, new byte[1])); Assert.Throws <ArgumentException>(() => new MessagePackExtendedTypeObject(255, new byte[1])); Assert.DoesNotThrow(() => new MessagePackExtendedTypeObject(0, new byte[0])); Assert.Throws <ArgumentNullException>(() => new MessagePackExtendedTypeObject(0, null)); }
public void CheckThatPropertyVirtualTest_Not_Throws_On_Virtual() { var virtualGetSetProp = typeof(CustomItem).GetProperty("CustomUser"); NuAssert.DoesNotThrow(() => ShpcAssert.IsPropertyVirtual(virtualGetSetProp)); var virtualGetProp = typeof(CustomItem).GetProperty("Author"); NuAssert.DoesNotThrow(() => ShpcAssert.IsPropertyVirtual(virtualGetProp)); }
public void UnwrapWithoutParent() { string s = "This is <b> a big</b> text"; var f = CQ.Create(s); Assert.DoesNotThrow(() => { f["b"].Unwrap().Render(); }); }
public void Patient_Field_ValidateCorrectValue_Correct( [Values(nameof(Patient.FirstName), nameof(Patient.LastName), nameof(Patient.MiddleName))] string fieldName ) { var patient = new Patient(); var prop = patient.GetType().GetProperty(fieldName); prop?.SetValue(patient, "Имя"); Assert.DoesNotThrow(() => patient.ValidateNameValue(prop?.Name)); }
public void TriangleCreatingTest() { Assert.That(() => new Triangle(1, 4, 5), Throws.TypeOf <ArgumentException>()); Assert.That(() => new Triangle(-1, 4, 5), Throws.TypeOf <ArgumentException>()); Assert.That(() => new Triangle(0, 0, 0), Throws.TypeOf <ArgumentException>()); Assert.DoesNotThrow(() => new Triangle(3, 4, 5)); }
public void When_Constructor_is_called_with_valid_parameters_Then_no_exception_is_thrown() { var timeProviderMock = new Mock <ITimeProvider>(); timeProviderMock.Setup(mock => mock.GetUtcNow()).Returns(new DateTime(2014, 11, 29, 12, 00, 00)); ApplicationTime.CurrentTimeProvider = timeProviderMock.Object; var sampleName = "SampleName"; Assert.DoesNotThrow(() => new BettingContest(new DateTime(2014, 11, 29, 12, 01, 00), sampleName)); }
public void DeleteNoteShouldNotThrowExceptionTest() { // Arrange const int UnknownId = 9999; // Act TestDelegate deleteAction = () => Repository.DeleteNote(UnknownId); // Assert Assert.DoesNotThrow(deleteAction); }
public void AssertDoesNotThrowInReleaseBuilds() { if (isDebugBuild) { NUnitAssert.Ignore("This test is only for release build mode."); } NUnitAssert.DoesNotThrow(() => { CometPeakAssert.IsTrue(false, "This should NOT be thrown in release builds!"); }); }
private static bool TestGeoJsonDeserialize <T>(string json) where T : class { var jr = new JsonTextReader(new StringReader(json)); var s = new NetTopologySuite.IO.GeoJsonSerializer(); var f = default(T); Assert.DoesNotThrow(() => f = s.Deserialize <T>(jr)); Assert.IsNotNull(f); return(true); }
public void ProblemLanguages_KeepsExactMatchNeedingTrim_RemovesNotMatched_WritesOfflineCache() { using (var folder = new TemporaryFolder("ProblemLanguages_KeepsExactMatchNeedingTrim_RemovesNotMatched_WritesOfflineCache")) { LicenseChecker.SetOfflineFolder(folder.FolderPath); var checker = SimpleTest(true); Assert.That(File.Exists(checker.getCacheFile())); var json = LicenseChecker.ReadObfuscatedFile(checker.getCacheFile()); Assert.DoesNotThrow(() => DynamicJson.Parse(json)); LicenseChecker.SetOfflineFolder(null); } }
public void LoadFromFileTest(string filepath, int boardSize, int shipCount) { var path = Path.Combine(GetAssemblyPath(), filepath); Assert.DoesNotThrow(() => Board.LoadFromFile(path)); var board = Board.LoadFromFile(path); Assert.IsNotNull(board); Assert.AreEqual(shipCount, board.Ships.Count); Assert.AreEqual(boardSize, board.Size); }
public void Will_Not_Throw_An_Exception_If_The_List_Items_Are_Not_Dynamic() { // Arrange var someObjectList = new List <object> { null }; // Act TestDelegate test = () => Slapper.AutoMapper.MapDynamic <Person>(someObjectList); // Assert Assert.DoesNotThrow(test); }
public void CanAcceptCorrectData() { // Arrange Note wrongNote = new Note { Title = "Test", Message = "Test" }; // Act TestDelegate createAction = () => this.webNoteService.Create(wrongNote, null); // Assert Assert.DoesNotThrow(createAction); }
public void ShouldNotthrowExceptionWhenServiceisUp() { _mockGetStandards.Setup( x => x.GetAllStandards()).Returns(new List <StandardSummary> { new StandardSummary { Id = "401" }, new StandardSummary { Id = "52" } }); Assert.DoesNotThrow(() => _sut.Head()); }
public void ShouldNotThrowExceptionWhenServiceisUp() { _mockGetAssessmentOrgs.Setup( x => x.GetAllOrganisations()).Returns(new List <OrganisationSummary> { new OrganisationSummary { Id = "EPA0001" }, new OrganisationSummary { Id = "EPA0002" } }); Assert.DoesNotThrow(() => _sut.Head()); }
public void ShouldNotthrowExceptionWhenServiceisUp() { _mockGetFrameworks.Setup( x => x.GetAllFrameworks()).Returns(new List <FrameworkSummary> { new FrameworkSummary { Id = "0001" }, new FrameworkSummary { Id = "0002" } }); Assert.DoesNotThrow(() => _sut.Head()); }
public void Name_Set_CorrectValue() { //setup var CorrectValue = "Andrey"; var message = "Тест пройден"; //assert Assert.DoesNotThrow( () => { //act _contact.Name = CorrectValue; }, message); }