Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void MultiValueDictionary_Add_Set()
mvd.Add(42, 42);

mvd.Keys.Should().HaveCount(2);
mvd[5].Should().HaveCount(1);
mvd[5].Should().ContainSingle();
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ private static void CheckRuleDescriptorsNotEmpty(AnalyzerLanguage language)
ruleDetail.Title.Should().NotBeNull();
}

ruleDetails.Should().HaveSameCount(
ruleDetails.Select(descriptor => descriptor.Key).Distinct());
ruleDetails.Should().OnlyHaveUniqueItems();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ public void GetAllAnalyzerTypes()
var finder = new RuleFinder();

var countParameterless = finder.GetParameterlessAnalyzerTypes(AnalyzerLanguage.CSharp).Count();
finder.AllAnalyzerTypes.Count().Should().BeGreaterThan(countParameterless);
finder.AllAnalyzerTypes.Should().HaveCountGreaterThan(countParameterless);

countParameterless = finder.GetParameterlessAnalyzerTypes(AnalyzerLanguage.VisualBasic).Count();
finder.AllAnalyzerTypes.Count().Should().BeGreaterThan(countParameterless);
finder.AllAnalyzerTypes.Should().HaveCountGreaterThan(countParameterless);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,7 @@ public void Cfg_Coalesce_Multiple()
dBlock.SuccessorBlocks.Should().OnlyContain(bcdBlock);
bcdBlock.SuccessorBlocks.Should().OnlyContain(exitBlock);

bcdBlock.Instructions.Should().HaveCount(1);
bcdBlock.Instructions.Should().ContainSingle();
bcdBlock.Instructions.Should().Contain(i => i.ToString() == "a = b ?? c ?? d");
}

Expand Down Expand Up @@ -1502,7 +1502,7 @@ public void Cfg_ConditionalMultiple()
.SuccessorBlocks.First().Should().Be(cfg.ExitBlock);

var assignmentBlock = cfg.ExitBlock.PredecessorBlocks.First();
assignmentBlock.Instructions.Should().HaveCount(1);
assignmentBlock.Instructions.Should().ContainSingle();
assignmentBlock.Instructions.Should().Contain(i => i.ToString() == "a = cond1 ? (cond2?x:y) : (cond3?p:q)");
}

Expand All @@ -1529,7 +1529,7 @@ public void Cfg_ConditionalAccess()

branchBlock.BranchingNode.Kind().Should().Be(SyntaxKind.ConditionalAccessExpression);

branchBlock.Instructions.Should().HaveCount(1);
branchBlock.Instructions.Should().ContainSingle();
branchBlock.Instructions.Should().Contain(i => i.ToString() == "o");

VerifyAllInstructions(branchBlock, "o");
Expand Down Expand Up @@ -3312,7 +3312,7 @@ private static IControlFlowGraph Build(string methodBody)

private void VerifyInstructions(Block block, int fromIndex, params string[] instructions)
{
block.Instructions.Count.Should().BeGreaterOrEqualTo(fromIndex + instructions.Length);
block.Instructions.Should().HaveCountGreaterOrEqualTo(fromIndex + instructions.Length);
for (var i = 0; i < instructions.Length; i++)
{
block.Instructions[fromIndex + i].ToString().Should().Be(instructions[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public void ExplodedGraph_BothBranchesVisited()
"and thus should be processed only once.");
numberOfLastInstructionVisits.Should().Be(2);

visitedBlocks.Count.Should().Be(cfg.Blocks.Count() - 1 /* Exit block*/);
visitedBlocks.Should().HaveCount(cfg.Blocks.Count() - 1 /* Exit block*/);
}

[TestMethod]
Expand Down Expand Up @@ -427,7 +427,7 @@ public void ExplodedGraph_BothBranchesVisited_NonCondition()
explodedGraph.Walk();

explorationEnded.Should().BeTrue();
visitedBlocks.Count.Should().Be(cfg.Blocks.Count() - 1 /* Exit block */);
visitedBlocks.Should().HaveCount(cfg.Blocks.Count() - 1 /* Exit block */);
countConditionEvaluated.Should().Be(0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void TrySetConstraint_Existing_No_Set_True()

var newProgramStates = this.sv_0.TrySetConstraint(BoolConstraint.True, ps).ToList();

newProgramStates.Should().HaveCount(1);
newProgramStates.Should().ContainSingle();
ShouldHaveConstraint(newProgramStates[0], this.sv_0, NullableValueConstraint.HasValue);
ShouldHaveConstraint(newProgramStates[0], this.sv_w, BoolConstraint.True);
}
Expand All @@ -57,7 +57,7 @@ public void TrySetConstraint_Existing_No_Set_False()

var newProgramStates = this.sv_0.TrySetConstraint(BoolConstraint.False, ps).ToList();

newProgramStates.Should().HaveCount(1);
newProgramStates.Should().ContainSingle();
ShouldHaveConstraint(newProgramStates[0], this.sv_0, NullableValueConstraint.HasValue);
ShouldHaveConstraint(newProgramStates[0], this.sv_w, BoolConstraint.False);
}
Expand All @@ -69,7 +69,7 @@ public void TrySetConstraint_Existing_No_Set_NoValue()

var newProgramStates = this.sv_0.TrySetConstraint(NullableValueConstraint.NoValue, ps).ToList();

newProgramStates.Should().HaveCount(1);
newProgramStates.Should().ContainSingle();
ShouldHaveConstraint(newProgramStates[0], this.sv_0, NullableValueConstraint.NoValue);
}

Expand All @@ -80,7 +80,7 @@ public void TrySetConstraint_Existing_No_Set_HasValue()

var newProgramStates = this.sv_0.TrySetConstraint(NullableValueConstraint.HasValue, ps).ToList();

newProgramStates.Should().HaveCount(1);
newProgramStates.Should().ContainSingle();
ShouldHaveConstraint(newProgramStates[0], this.sv_0, NullableValueConstraint.HasValue);
}

Expand All @@ -91,7 +91,7 @@ public void TrySetConstraint_Existing_No_Set_Null()

var newProgramStates = this.sv_0.TrySetConstraint(ObjectConstraint.Null, ps).ToList();

newProgramStates.Should().HaveCount(1);
newProgramStates.Should().ContainSingle();
ShouldHaveConstraint(newProgramStates[0], this.sv_0, NullableValueConstraint.NoValue);
}

Expand All @@ -102,7 +102,7 @@ public void TrySetConstraint_Existing_No_Set_NotNull()

var newProgramStates = this.sv_0.TrySetConstraint(ObjectConstraint.NotNull, ps).ToList();

newProgramStates.Should().HaveCount(1);
newProgramStates.Should().ContainSingle();
ShouldHaveConstraint(newProgramStates[0], this.sv_0, NullableValueConstraint.HasValue);
}

Expand Down Expand Up @@ -133,7 +133,7 @@ public void TrySetConstraint_Existing_True_Set_False()

var newProgramStates = this.sv_0.TrySetConstraint(BoolConstraint.False, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -143,7 +143,7 @@ public void TrySetConstraint_Existing_True_Set_NoValue()

var newProgramStates = this.sv_0.TrySetConstraint(NullableValueConstraint.NoValue, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -163,7 +163,7 @@ public void TrySetConstraint_Existing_True_Set_Null()

var newProgramStates = this.sv_0.TrySetConstraint(ObjectConstraint.Null, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand Down Expand Up @@ -193,7 +193,7 @@ public void TrySetConstraint_Existing_False_Set_True()

var newProgramStates = this.sv_0.TrySetConstraint(BoolConstraint.True, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -213,7 +213,7 @@ public void TrySetConstraint_Existing_False_Set_NoValue()

var newProgramStates = this.sv_0.TrySetConstraint(NullableValueConstraint.NoValue, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -233,7 +233,7 @@ public void TrySetConstraint_Existing_False_Set_Null()

var newProgramStates = this.sv_0.TrySetConstraint(ObjectConstraint.Null, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand Down Expand Up @@ -263,7 +263,7 @@ public void TrySetConstraint_Existing_NoValue_Set_True()

var newProgramStates = this.sv_0.TrySetConstraint(BoolConstraint.True, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -273,7 +273,7 @@ public void TrySetConstraint_Existing_NoValue_Set_False()

var newProgramStates = this.sv_0.TrySetConstraint(BoolConstraint.False, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -293,7 +293,7 @@ public void TrySetConstraint_Existing_NoValue_Set_HasValue()

var newProgramStates = this.sv_0.TrySetConstraint(NullableValueConstraint.HasValue, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -313,7 +313,7 @@ public void TrySetConstraint_Existing_NoValue_Set_NotNull()

var newProgramStates = this.sv_0.TrySetConstraint(ObjectConstraint.NotNull, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -333,7 +333,7 @@ public void TrySetConstraint_Existing_HasValue_Set_True()

var newProgramStates = this.sv_0.TrySetConstraint(BoolConstraint.True, ps).ToList();

newProgramStates.Should().HaveCount(1);
newProgramStates.Should().ContainSingle();
ShouldHaveConstraint(newProgramStates[0], this.sv_0, NullableValueConstraint.HasValue);
ShouldHaveConstraint(newProgramStates[0], this.sv_w, BoolConstraint.True);
}
Expand All @@ -345,7 +345,7 @@ public void TrySetConstraint_Existing_HasValue_Set_False()

var newProgramStates = this.sv_0.TrySetConstraint(BoolConstraint.False, ps).ToList();

newProgramStates.Should().HaveCount(1);
newProgramStates.Should().ContainSingle();
ShouldHaveConstraint(newProgramStates[0], this.sv_0, NullableValueConstraint.HasValue);
ShouldHaveConstraint(newProgramStates[0], this.sv_w, BoolConstraint.False);
}
Expand All @@ -357,7 +357,7 @@ public void TrySetConstraint_Existing_HasValue_Set_NoValue()

var newProgramStates = this.sv_0.TrySetConstraint(NullableValueConstraint.NoValue, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -377,7 +377,7 @@ public void TrySetConstraint_Existing_HasValue_Set_Null()

var newProgramStates = this.sv_0.TrySetConstraint(ObjectConstraint.Null, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand Down Expand Up @@ -407,7 +407,7 @@ public void TrySetConstraint_Existing_Null_Set_True()

var newProgramStates = this.sv_0.TrySetConstraint(BoolConstraint.True, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -417,7 +417,7 @@ public void TrySetConstraint_Existing_Null_Set_False()

var newProgramStates = this.sv_0.TrySetConstraint(BoolConstraint.False, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -437,7 +437,7 @@ public void TrySetConstraint_Existing_Null_Set_HasValue()

var newProgramStates = this.sv_0.TrySetConstraint(NullableValueConstraint.HasValue, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -457,7 +457,7 @@ public void TrySetConstraint_Existing_Null_Set_NotNull()

var newProgramStates = this.sv_0.TrySetConstraint(ObjectConstraint.NotNull, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -477,7 +477,7 @@ public void TrySetConstraint_Existing_NotNull_Set_True()

var newProgramStates = this.sv_0.TrySetConstraint(BoolConstraint.True, ps).ToList();

newProgramStates.Should().HaveCount(1);
newProgramStates.Should().ContainSingle();
ShouldHaveConstraint(newProgramStates[0], this.sv_0, NullableValueConstraint.HasValue);
ShouldHaveConstraint(newProgramStates[0], this.sv_w, BoolConstraint.True);
}
Expand All @@ -489,7 +489,7 @@ public void TrySetConstraint_Existing_NotNull_Set_False()

var newProgramStates = this.sv_0.TrySetConstraint(BoolConstraint.False, ps).ToList();

newProgramStates.Should().HaveCount(1);
newProgramStates.Should().ContainSingle();
ShouldHaveConstraint(newProgramStates[0], this.sv_0, NullableValueConstraint.HasValue);
ShouldHaveConstraint(newProgramStates[0], this.sv_w, BoolConstraint.False);
}
Expand All @@ -501,7 +501,7 @@ public void TrySetConstraint_Existing_NotNull_Set_NoValue()

var newProgramStates = this.sv_0.TrySetConstraint(NullableValueConstraint.NoValue, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand All @@ -521,7 +521,7 @@ public void TrySetConstraint_Existing_NotNull_Set_Null()

var newProgramStates = this.sv_0.TrySetConstraint(ObjectConstraint.Null, ps).ToList();

newProgramStates.Should().HaveCount(0);
newProgramStates.Should().BeEmpty();
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void TrySetOppositeConstraint_Existing_No_Set_None()

var newProgramStates = this.sv_0.TrySetOppositeConstraint(NullableValueConstraint.NoValue, ps).ToList();

newProgramStates.Should().HaveCount(1);
newProgramStates.Should().ContainSingle();
ShouldHaveConstraint(newProgramStates[0], this.sv_0, NullableValueConstraint.HasValue);
}

Expand All @@ -84,7 +84,7 @@ public void TrySetOppositeConstraint_Existing_No_Set_Some()

var newProgramStates = this.sv_0.TrySetOppositeConstraint(NullableValueConstraint.HasValue, ps).ToList();

newProgramStates.Should().HaveCount(1);
newProgramStates.Should().ContainSingle();
ShouldHaveConstraint(newProgramStates[0], this.sv_0, NullableValueConstraint.NoValue);
}

Expand All @@ -95,7 +95,7 @@ public void TrySetOppositeConstraint_Existing_No_Set_Null()

var newProgramStates = this.sv_0.TrySetOppositeConstraint(ObjectConstraint.Null, ps).ToList();

newProgramStates.Should().HaveCount(1);
newProgramStates.Should().ContainSingle();
ShouldHaveConstraint(newProgramStates[0], this.sv_0, NullableValueConstraint.HasValue);
}

Expand Down
Loading