示例#1
0
        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();
        }
示例#2
0
        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();
        }
示例#3
0
        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();
        }
示例#4
0
        public MobileSpec Add(MobileSpec mobileSpec)
        {
            var mobilespecAdded = _unitOfWork.MobileSpecsRepository.Add(mobileSpec);

            _unitOfWork.SaveChanges();
            return(mobilespecAdded);
        }
示例#5
0
        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();
        }
示例#6
0
        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();
        }
示例#7
0
        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();
        }
示例#8
0
        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);
        }
示例#9
0
        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);
        }
示例#10
0
        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);
        }
示例#11
0
        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();
        }
示例#12
0
        public void Spec_with_ModelId_and_Color_doesnt_match_same_ModelId()
        {
            var spec = new MobileSpec(0x4444, (Color)0x5555);

            spec.Matches(0x4444).Should().BeFalse();
        }
示例#13
0
        public void Spec_with_ModelId_doesnt_match_different_ModelId()
        {
            var spec = new MobileSpec(0x4444);

            spec.Matches(0x1111).Should().BeFalse();
        }
示例#14
0
        public void Spec_with_ModelId_matches_same_ModelId()
        {
            var spec = new MobileSpec(0x4444);

            spec.Matches(0x4444).Should().BeTrue();
        }