示例#1
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();
        }
示例#2
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();
        }
示例#3
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();
        }
示例#4
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();
        }
示例#5
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();
        }
示例#6
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();
        }
示例#7
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();
        }
示例#8
0
        public void Spec_with_ModelId_and_Color_doesnt_match_same_ModelId()
        {
            var spec = new MobileSpec(0x4444, (Color)0x5555);

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

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

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