示例#1
0
        /// <summary>
        /// Create a new instance of a Property.
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="type"></param>
        /// <param name="classification"></param>
        /// <param name="address"></param>
        /// <param name="tenure"></param>
        /// <param name="areaUnit"></param>
        /// <param name="dataSource"></param>
        /// <returns></returns>
        public static Entity.PimsProperty CreateProperty(int pid, int?pin = null, Entity.PimsPropertyType type = null, Entity.PimsPropertyClassificationType classification = null, Entity.PimsAddress address = null, Entity.PimsPropertyTenureType tenure = null, Entity.PimsAreaUnitType areaUnit = null, Entity.PimsDataSourceType dataSource = null, Entity.PimsLease lease = null)
        {
            type ??= EntityHelper.CreatePropertyType("Land");
            classification ??= EntityHelper.CreatePropertyClassificationType("Class");
            address ??= EntityHelper.CreateAddress(pid);
            tenure ??= EntityHelper.CreatePropertyTenureType("Tenure");

            areaUnit ??= EntityHelper.CreatePropertyAreaUnitType("Sqft");
            dataSource ??= EntityHelper.CreateDataSourceType("LIS");
            var property = new Entity.PimsProperty(pid, type, classification, address, new Entity.PimsPropPropTenureType {
                PropertyTenureTypeCodeNavigation = tenure
            }, areaUnit, dataSource, DateTime.UtcNow)
            {
                PropertyId = pid,
                Pin        = pin,
                ConcurrencyControlNumber = 1,
                Location = new NetTopologySuite.Geometries.Point(0, 0)
            };

            if (lease != null)
            {
                lease.PimsPropertyLeases.Add(new Entity.PimsPropertyLease()
                {
                    Property = property, Lease = lease
                });
            }
            return(property);
        }
示例#2
0
 /// <summary>
 /// Create a new instance of a PropertyOrganization class.
 /// </summary>
 /// <param name="property"></param>
 /// <param name="organization"></param>
 public PimsPropertyOrganization(PimsProperty property, PimsOrganization organization):this()
 {
     this.Property = property ?? throw new ArgumentNullException(nameof(property));
     this.PropertyId = property.PropertyId;
     this.Organization = organization ?? throw new ArgumentNullException(nameof(organization));
     this.OrganizationId = organization.Id;
 }
示例#3
0
        public void ThrowBadRequestIfNull_ArgumentException(string message)
        {
            // Arrange
            Entity.PimsProperty property = null;

            // Act
            // Assert
            Assert.Throws <ArgumentException>(() => property.ThrowBadRequestIfNull(message));
        }
示例#4
0
        public void ThrowBadRequestIfNull_WithNull()
        {
            // Arrange
            Entity.PimsProperty property = null;

            // Act
            // Assert
            Assert.Throws <BadRequestException>(() => property.ThrowBadRequestIfNull("test"));
        }
示例#5
0
        public void ThrowBadRequestIfNull_WithObject()
        {
            // Arrange
            var property = new Entity.PimsProperty();

            // Act
            property.ThrowBadRequestIfNull("test");

            // Assert
            Assert.NotNull(property);
        }
示例#6
0
        public void Not_Equal_Null1()
        {
            // Arrange
            Entity.PimsProperty parcel1 = null;
            var parcel2 = EntityHelper.CreateProperty(1);

            var comparer = new DeepPropertyCompare <Entity.PimsProperty>();

            // Act
            var result = comparer.Equals(parcel1, parcel2);

            // Assert
            Assert.False(result);
        }
        public void Not_Equal_Null2()
        {
            // Arrange
            var parcel1 = EntityHelper.CreateProperty(1);

            Entity.PimsProperty parcel2 = null;

            var comparer = new ShallowPropertyCompare();

            // Act
            var result = comparer.Equals(parcel1, parcel2);

            // Assert
            Assert.False(result);
        }