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);
        }
        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);
                }
            }
        }
 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;
 }
 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);
     }
 }