protected bool Equals(Workstation other)
        {
            var isEqual = 
                this.WorkstationId == other.WorkstationId
                && this.BuildingId == other.BuildingId
                && string.Equals(this.Name, other.Name)
                && this.AccessLevel == other.AccessLevel
                && !(this.Employees??new Employee[0]).Except(other.Employees??new Employee[0]).Any();

            if (isEqual)
            {
                if (!_isCheckingForBuildingEquality)
                {
                    _isCheckingForBuildingEquality = true;
                    try
                    {
                        return object.Equals(this.Building, other.Building);
                    }
                    finally
                    {
                        _isCheckingForBuildingEquality = false;
                    }
                }
            }

            return isEqual;
        }
        protected bool Equals(Workstation other)
        {
            var isEqual =
                this.WorkstationId == other.WorkstationId &&
                this.BuildingId == other.BuildingId &&
                string.Equals(this.Name, other.Name) &&
                this.AccessLevel == other.AccessLevel &&
                !(this.Employees ?? new Employee[0]).Except(other.Employees ?? new Employee[0]).Any();

            if (isEqual)
            {
                if (!_isCheckingForBuildingEquality)
                {
                    _isCheckingForBuildingEquality = true;
                    try
                    {
                        return(object.Equals(this.Building, other.Building));
                    }
                    finally
                    {
                        _isCheckingForBuildingEquality = false;
                    }
                }
            }

            return(isEqual);
        }
Exemplo n.º 3
0
        public void WhenIUpdateAllTheInsertedWorkstationEntities(bool useAsyncMethods)
        {
            foreach (var insertedEntity in _testContext.InsertedEntities.OfType<Workstation>())
            {
                var updatedEntity = new Workstation()
                {
                    WorkstationId = insertedEntity.WorkstationId,
                    Name = "Updated " + insertedEntity.Name
                };
                _testContext.UpdatedEntities.Add(updatedEntity);
                if (useAsyncMethods)
                {
                    _testContext.DatabaseConnection.UpdateAsync(updatedEntity).GetAwaiter().GetResult();

                }
                else
                {
                    _testContext.DatabaseConnection.Update(updatedEntity);
                }
            }
        }
Exemplo n.º 4
0
 public void WhenIQueryForTheInsertedWorkstationEntities(bool useAsyncMethods)
 {
     foreach (var insertedEntity in _testContext.InsertedEntities.OfType<Workstation>())
     {
         var entityQuery = new Workstation() { WorkstationId = insertedEntity.WorkstationId };
         _testContext.QueriedEntities.Add(useAsyncMethods
             ? _testContext.DatabaseConnection.GetAsync<Workstation>(entityQuery).Result
             :_testContext.DatabaseConnection.Get<Workstation>(entityQuery));
     }
 }
 protected bool Equals(Workstation other)
 {
     return this.WorkstationId == other.WorkstationId && string.Equals(this.Name, other.Name) && this.AccessLevel == other.AccessLevel;
 }
Exemplo n.º 6
0
 public void WhenIUpdateAllTheInsertedWorkstationEntities()
 {
     foreach (var insertedEntity in _testContext.InsertedEntities.OfType<Workstation>())
     {
         var updatedEntity = new Workstation()
         {
             WorkstationId = insertedEntity.WorkstationId,
             Name = "Updated " + insertedEntity.Name
         };
         _testContext.UpdatedEntities.Add(updatedEntity);
         _testContext.DatabaseConnection.Update(updatedEntity);
     }
 }