public void CountWithPredicate() { const string assertion = "actual.Count(d => d.Message.Contains(\"a\")).Should().Be(2);"; var source = GenerateCode.EnumerableCodeBlockAssertion(assertion); DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(source); }
public void PropertyOfIndexerShouldBe_ShouldNotThrowException() { const string assertion = "actual[0].Message.Should().Be(\"test\");"; var source = GenerateCode.EnumerableCodeBlockAssertion(assertion); DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(source); }
public void PropertyOfElementAtShouldBe_ShouldNotTriggerDiagnostic() { const string assertion = "actual.ElementAt(0).Message.Should().Be(\"test\");"; var source = GenerateCode.EnumerableCodeBlockAssertion(assertion); DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(source); }
public void AssertionCallMultipleMethodWithTheSameNameAndArguments() { const string assertion = "actual.Should().Contain(d => d.Message.Contains(\"a\")).And.Contain(d => d.Message.Contains(\"c\"));"; var source = GenerateCode.EnumerableCodeBlockAssertion(assertion); DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(source); }
public void NestedAssertions_ShouldNotTrigger() { const string declaration = "var nestedList = new List<List<int>>();"; const string assertion = "nestedList.Should().NotBeNull().And.ContainSingle().Which.Should().NotBeEmpty();"; var source = GenerateCode.EnumerableCodeBlockAssertion(declaration + assertion); DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(source); }