public void Spec_with_ModelId_not_matching_Item_with_other_ModelId() { var spec = new MobileSpec(0x4444); var mobile = new Mobile(new ObjectId(0), 0x2222, new Location3D(0, 0, 0), (Color)0, null, null, null); spec.Matches(mobile).Should().BeFalse(); }
public void Spec_with_ModelId_and_Color_not_matching_Item_with_different_Color() { var spec = new MobileSpec(0x4444, (Color)0x22); var mobile = new Mobile(new ObjectId(0), 0x4444, new Location3D(0, 0, 0), (Color)0x99, null, null, null); spec.Matches(mobile).Should().BeFalse(); }
public void Spec_with_ModelId_matches_Mobile_with_same_ModelId() { var spec = new MobileSpec(0x4444); var mobile = new Mobile(new ObjectId(0), 0x4444, new Location3D(0, 0, 0)); spec.Matches(mobile).Should().BeTrue(); }
public MobileSpec Add(MobileSpec mobileSpec) { var mobilespecAdded = _unitOfWork.MobileSpecsRepository.Add(mobileSpec); _unitOfWork.SaveChanges(); return(mobilespecAdded); }
public void Spec_with_no_matching_subspecs_Not_Matching_mobile() { var spec = new MobileSpec(new MobileSpec(0x1111), new MobileSpec(0x2222)); var mobile = new Mobile(new ObjectId(0), 0x9999, new Location3D(0, 0, 0), (Color)0x99, null, null, null); spec.Matches(mobile).Should().BeFalse(); }
public void Can_construct_spec_by_listing_subspecs() { var spec = new MobileSpec(0x1111).Including(new MobileSpec(0x2222), new MobileSpec(0x3333)); spec.Matches(new Mobile(new ObjectId(0), 0x1111, new Location3D(0, 0, 0), (Color)0x99, null, null, null)).Should().BeTrue(); spec.Matches(new Mobile(new ObjectId(0), 0x2222, new Location3D(0, 0, 0), (Color)0x99, null, null, null)).Should().BeTrue(); spec.Matches(new Mobile(new ObjectId(0), 0x3333, new Location3D(0, 0, 0), (Color)0x99, null, null, null)).Should().BeTrue(); }
public void Matching_when_any_subspecs_has_same_ModelId() { var spec = new MobileSpec(new MobileSpec(0x1111), new MobileSpec(0x2222)); spec.Matches(0x1111).Should().BeTrue(); spec.Matches(0x2222).Should().BeTrue(); spec.Matches(0x3333).Should().BeFalse(); }
public void Spec_with_name_is_more_specific_than_Spec_with_type_and_with_type_and_color() { var withName = new MobileSpec("name"); var withTypeAndColor = new MobileSpec(0x3333, (Color)0x0010); var withType = new MobileSpec(0x3333); withName.Specificity.Should().BeGreaterThan(withTypeAndColor.Specificity); withName.Specificity.Should().BeGreaterThan(withType.Specificity); }
public void Spec_with_type_and_color_is_more_specific_than_spec_with_type_and_with_subspecs() { var withSubspecs = new MobileSpec(0x1111).Including(new MobileSpec(0x2222), new MobileSpec(0x3333)); var withType = new MobileSpec(0x2222); var withTypeAndColor = new MobileSpec(0x3333, (Color)0x0010); withTypeAndColor.Specificity.Should().BeGreaterThan(withSubspecs.Specificity); withTypeAndColor.Specificity.Should().BeGreaterThan(withType.Specificity); }
public void Spec_with_subspecs_is_least_specific() { var withSubspecs = new MobileSpec(0x1111).Including(new MobileSpec(0x2222), new MobileSpec(0x3333)); var withType = new MobileSpec(0x2222); var withTypeAndColor = new MobileSpec(0x3333, (Color)0x0010); withSubspecs.Specificity.Should().BeLessThan(withType.Specificity); withSubspecs.Specificity.Should().BeLessThan(withTypeAndColor.Specificity); }
public void Speci_with_Name_matches_Mobile_with_same_Name() { var spec = new MobileSpec("TestName"); var mobile = new Mobile(new ObjectId(0), 0x4444, new Location3D(0, 0, 0)); mobile = (Mobile)mobile.UpdateName("TestName"); spec.Matches(mobile).Should().BeTrue(); }
public void Spec_with_ModelId_and_Color_doesnt_match_same_ModelId() { var spec = new MobileSpec(0x4444, (Color)0x5555); spec.Matches(0x4444).Should().BeFalse(); }
public void Spec_with_ModelId_doesnt_match_different_ModelId() { var spec = new MobileSpec(0x4444); spec.Matches(0x1111).Should().BeFalse(); }
public void Spec_with_ModelId_matches_same_ModelId() { var spec = new MobileSpec(0x4444); spec.Matches(0x4444).Should().BeTrue(); }