コード例 #1
0
        // only for local tests
        // [Test]
        public void RoomCompare()
        {
            var id = "Room_e6ac360b-aaed-4c3b-a130-36b4c2ac9d13-000d14cc";
            var f  = @"C:\Users\mingo\Desktop\New folder\New folder\model_from_revit.hbjson";
            var f2 = @"C:\Users\mingo\Desktop\New folder\New folder\model_updated.hbjson";

            var j1 = System.IO.File.ReadAllText(f);
            var j2 = System.IO.File.ReadAllText(f2);

            var m1 = Model.FromJson(j1);
            var m2 = Model.FromJson(j2);

            var diffs = new List <Room>();

            foreach (var item in m1.Rooms)
            {
                var match = m2.Rooms.FirstOrDefault(_ => _.Identifier == item.Identifier);
                if (match != item)
                {
                    diffs.Add(match);
                }
            }

            Assert.IsTrue(diffs.Any());

            var r1 = m1.Rooms.FirstOrDefault(_ => _.Identifier == id);
            var r2 = m2.Rooms.FirstOrDefault(_ => _.Identifier == id);


            Assert.IsTrue(Extension.Equals(r1.UserData, r2.UserData));

            Assert.IsTrue(r1.Properties.Equals(r2.Properties));

            Assert.IsTrue(Extension.AllEquals(r1.Faces, r2.Faces));
            Assert.IsTrue(Extension.AllEquals(r1.IndoorShades, r2.IndoorShades));
            Assert.IsTrue(Extension.AllEquals(r1.OutdoorShades, r2.OutdoorShades));
            Assert.IsTrue(r1.Equals(r2));
        }
コード例 #2
0
        public void EqualInstanceTest()
        {
            var p1 = new List <List <double> >()
            {
                new List <double>()
                {
                    0.11111, 0.22222, 0.333333
                }
            };
            var p2 = new List <List <double> >()
            {
                new List <double>()
                {
                    0.11110, 0.22222, 0.333333
                }
            };
            var p3 = new List <List <double> >()
            {
                new List <double>()
                {
                    0.11221, 0.22222, 0.333333
                }
            };

            var arePtsSame = Extension.AllEquals(p1, p2);

            Assert.IsTrue(arePtsSame);

            var arePtsNotSame = Extension.AllEquals(p1, p3);

            Assert.IsFalse(arePtsNotSame);

            var door2  = this.instance.DuplicateDoor();
            var isSame = door2.Equals(instance);

            Assert.IsTrue(isSame);


            var hole  = new List <List <List <double> > >();
            var hole2 = new List <List <List <double> > >();

            hole = null;
            var isListSame = Extension.AllEquals(hole, hole2);

            Assert.IsTrue(isListSame);


            instance.Geometry.Holes = null;
            door2.Geometry.Holes    = new List <List <List <double> > >();
            Assert.IsTrue(door2.Equals(instance));
            Assert.IsTrue(door2 == instance);

            instance.IndoorShades = new List <Shade>();
            door2.IndoorShades    = null;
            Assert.IsTrue(door2.Equals(instance));
            Assert.IsTrue(door2 == instance);

            instance.IndoorShades = new List <Shade>()
            {
                new Shade("nn", new Face3D(new List <List <double> >()), new ShadePropertiesAbridged())
            };
            Assert.IsFalse(door2.Equals(instance));
            Assert.IsFalse(door2 == instance);
        }