public void DoubleNotSpecificationTrueTest(string name) { var spec1 = new SpecificationBase <SimpleTestObject>(t => t.Name == name); var spec = !!spec1; Assert.True(spec.IsSatisfiedBy(SimpleTestObject.Create_For_Test_Where_Count_Is_Five_And_Name_Is_Name())); }
public void SpecificationOrSpecificationFalseTest(string name, int count) { var spec1 = new SpecificationBase <SimpleTestObject>(t => t.Name == name); var spec2 = new SpecificationBase <SimpleTestObject>(t => t.Count == count); var spec = spec1 | spec2; Assert.False(spec.IsSatisfiedBy(SimpleTestObject.Create_For_Test_Where_Count_Is_Five_And_Name_Is_Name())); Assert.False(spec.Or(spec2).IsSatisfiedBy(SimpleTestObject.Create_For_Test_Where_Count_Is_Five_And_Name_Is_Name())); }
public void NotSpecificationTest(string name) { var trueSpec = new SpecificationBase <SimpleTestObject>(t => t.Name == name); var falseSpec = !trueSpec; Assert.True(trueSpec.IsSatisfiedBy(SimpleTestObject.Create_For_Test_Where_Count_Is_Five_And_Name_Is_Name())); Assert.False(falseSpec.IsSatisfiedBy(SimpleTestObject.Create_For_Test_Where_Count_Is_Five_And_Name_Is_Name())); Assert.True(trueSpec.IsSatisfiedBy(SimpleTestObject.Create_For_Test_Where_Count_Is_Five_And_Name_Is_Name())); Assert.False(trueSpec.Not().IsSatisfiedBy(SimpleTestObject.Create_For_Test_Where_Count_Is_Five_And_Name_Is_Name())); }
public void SingleSpecificationWorked() { string s = "Name"; var spec = new SpecificationBase <SimpleTestObject>(t => t.Name == s); using (var db = EfFactory.CreateTestContext()) { var test = db.SetOfTestObjects.Where(spec).Single(); var testExpected = SimpleTestObject.Create_For_Test_Where_Count_Is_Five_And_Name_Is_Name(); Assert.Equal(testExpected.Name, test.Name); Assert.Equal(testExpected.Count, test.Count); } }
public void SingleSpecificationWorked() { var spec = new SpecificationBase <SimpleTestObject>(t => t.Name == "Name"); Assert.True(spec.IsSatisfiedBy(SimpleTestObject.Create_For_Test_Where_Count_Is_Five_And_Name_Is_Name())); }